在windows下,一个网卡可以绑定多个IP地址,只要在网卡的“TCP/IP 属性”的“高级”选项中添加具体的IP地址就可以实现了
在LINUX下面一样可以实现,而且相当简单
操作步骤如下:
[root@ns1 ~]# cd /etc/sysconfig/network-scripts/
[root@ns1 network-scripts]# ls
ifcfg-eth0 ifdown-isdn ifup-aliases ifup-plip ifup-wireless
ifcfg-lo ifdown-post ifup-bnep ifup-plusb init.ipv6-global
ifdown ifdown-ppp ifup-eth ifup-post net.hotplug
ifdown-bnep ifdown-routes ifup-ippp ifup-ppp network-functions
ifdown-eth ifdown-sit ifup-ipsec ifup-routes network-functions-ipv6
ifdown-ippp ifdown-sl ifup-ipv6 ifup-sit
ifdown-ipsec ifdown-tunnel ifup-ipx ifup-sl
ifdown-ipv6 ifup ifup-isdn ifup-tunnel
[root@ns1 network-scripts]# cp ifcfg-eth0 ifcfg-eth0:1
[root@ns1 network-scripts]# vi ifcfg-eth0:1
# Digital Equipment Corporation DECchip 21140 [FasterNet]
DEVICE=eth0:1
BOOTPROTO=static
HWADDR=00:03:FF:43:1A:B9
ONBOOT=yes
IPADDR=192.168.0.30
NETMASK=255.255.255.0
[root@ns1 network-scripts]# cd
[root@ns1 ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@ns1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:03:FF:43:1A:B9
inet addr:192.168.0.20 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::203:ffff:fe43:1ab9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9137 errors:11 dropped:0 overruns:0 frame:0
TX packets:7251 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:775430 (757.2 KiB) TX bytes:905855 (884.6 KiB)
Interrupt:11 Base address:0x6000
eth0:1 Link encap:Ethernet HWaddr 00:03:FF:43:1A:B9
inet addr:192.168.0.30 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0x6000
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:116 errors:0 dropped:0 overruns:0 frame:0
TX packets:116 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10687 (10.4 KiB) TX bytes:10687 (10.4 KiB)
注意:eth0在这里可以设置为DHCP获得IP,但是eth0:1就不可以用DHCP了,必须设置成静态IP
阅读(666) | 评论(0) | 转发(0) |