在网卡上绑定多个ip

如果要在eth0网卡设备上添加两个lP别名192.168.8.43和192.168.8.44,可以通过以下的ifconfig和route命令来进行:

[root@ShadowFiend Gogo_yueyue]# ifconfig eth0:2 172.29.0.76 broadcast 172.29.255.255 netmask 255.255.0.0 up 
[root@ShadowFiend Gogo_yueyue]# route add -host 172.29.0.76 dev eth0:2


检验
[Gogo_yueyue@ShadowFiend ~]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1F:D0:38:32:8F  
          inet addr:172.29.0.43  Bcast:172.29.255.255  Mask:255.255.0.0
          inet6 addr: fe80::21f:d0ff:fe38:328f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:116576 errors:0 dropped:0 overruns:0 frame:0
          TX packets:61320 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:99672447 (95.0 MiB)  TX bytes:7184954 (6.8 MiB)
          Interrupt:28 Base address:0x2000 

eth0:2    Link encap:Ethernet  HWaddr 00:1F:D0:38:32:8F  
          inet addr:172.29.0.76  Bcast:172.29.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:28 Base address:0x2000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1649 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1649 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:466121 (455.1 KiB)  TX bytes:466121 (455.1 KiB)


你可能感兴趣的:(IP)