In Windows to set up a network card multiple IP, it is easier, today I write about in the Linux system, to a network card set multiple IP address, under the Linux system, the first card is called Eth0, the second network card is called eth1, Here we give the first network card set multiple IP, under Linux, configure the network card configuration file in the directory/etc/sysconfig/network-script/, the original network card configuration file named Ifcfg-eth0, We give a network card configuration of multiple IP address configuration file named Ifcfg-eth0:1 and Ifcfg-eth0:2, the following operation is as follows: Last Login:fri 6 00:35:49 from 172.28.102.41
[email protected] ~]# Ifconfig # # #原来网卡的配置
eth0Link encap:ethernet HWaddr 00:0c:29:d5:39:a0
inet Addr:
172.28.90.101 bcast:172.28.255.255 mask:255.255.0.0
Inet6 ADDR:FE80::20C:29FF:FED5:39A0/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:3125184 errors:0 dropped:0 overruns:0 frame:0
TX packets:101356 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:462342976 (440.9 MiB) TX bytes:10788008 (10.2 MiB)
interrupt:75 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:1427 errors:0 dropped:0 overruns:0 frame:0
TX packets:1427 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3335045 (3.1 mib) TX bytes:3335045 (3.1 mib) [[email protected] ~]# cd/etc/sysconfig/net
Netconsole Network networking/network-scripts/
[email protected] ~]# cd/etc/sysconfig/network-scripts/
#配置文件的目录路径
[[email protected] network-scripts]# ls
Ifcfg-eth0IFDOWN-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
[email protected] network-scripts]# CP ifcfg-eth0 ifcfg-eth0:1 #复制原来网卡配置
[email protected] network-scripts]# CP ifcfg-eth0 Ifcfg-eth0:2 #复制原来网卡配置
[Email protected] network-scripts]# VI ifcfg-eth0:1
# advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
Device=eth0:1#此处修改
Bootproto=static
broadcast=172.28.255.255
#IP地址的广播地址
Hwaddr=00:0c:29:d5:39:a0
#MAC地址, no modification.
ipaddr=172.28.90.201
#设置新的IP
netmask=255.255.0.0
network=172.28.0.0
Onboot=yes
~
——————————————————————————————————
~
"Ifcfg-eth0:1" 9L, 206C written
[Email protected] network-scripts]# VI ifcfg-eth0:2
# advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
Device=eth0:2
#此处修改
Bootproto=static
broadcast=172.28.255.255
#IP地址的广播地址
Hwaddr=00:0c:29:d5:39:a0
#MAC地址, no modification.
ipaddr=172.28.90.202
#设置新的IP
netmask=255.255.0.0
network=172.28.0.0
Onboot=yes
~
———————————————————————————————————
~
"Ifcfg-eth0:2" 9L, 206C written
[email protected] network-scripts]# service network restart #重启下网络服务
Shutting down interface eth0: [OK]
Shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing Up interface eth0: [OK]
[email protected] network-scripts]# ifconfig #修改好后验证是否成功
Eth0 Link encap:ethernet HWaddr 00:0c:29:d5:39:a0
inet Addr:
172.28.90.101 bcast:172.28.255.255 mask:255.255.0.0
Inet6 ADDR:FE80::20C:29FF:FED5:39A0/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:3131096 errors:0 dropped:0 overruns:0 frame:0
TX packets:101660 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:462925438 (441.4 MiB) TX bytes:10829005 (10.3 MiB)
interrupt:75 Base address:0x2000 eth0:1 Link encap:ethernet HWaddr 00:0c:29:d5:39:a0
inet Addr:
172.28.90.201bcast:172.28.255.255 mask:255.255.0.0
Up broadcast RUNNING multicast mtu:1500 metric:1
interrupt:75 Base address:0x2000 eth0:2 Link encap:ethernet HWaddr 00:0c:29:d5:39:a0
inet Addr:
172.28.90.202 bcast:172.28.255.255 mask:255.255.0.0
Up broadcast RUNNING multicast mtu:1500 metric:1
interrupt:75 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:1427 errors:0 dropped:0 overruns:0 frame:0
TX packets:1427 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3335045 (3.1 mib) TX bytes:3335045 (3.1 MiB)
[[email protected] network-scripts]# ls
Ifcfg-eth0 Ifdown-ipsec Ifdown-tunnel ifup-ipx IFUP-SL
ifcfg-eth0:1 Ifdown-ipv6 ifup ifup-isdn Ifup-tunnel
ifcfg-eth0:2 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
[Email protected] network-scripts]#
We will wind under the verification of whether the pass ...
C:\Documents and settings\administrator>ping 172.28.90.101
Pinging 172.28.90.101 with + bytes of data:
Reply from 172.28.90.101:bytes=32 time=17ms ttl=63
Reply from 172.28.90.101:bytes=32 time=14ms ttl=63Ping statistics for 172.28.90.101:
Packets:sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in Milli-seconds:
Minimum = 14ms, Maximum = 17ms, Average = 15ms
Control-c
^c
C:\Documents and settings\administrator>ping 172.28.90.201
Pinging 172.28.90.201 with + bytes of data:
Reply from 172.28.90.201:bytes=32 time=38ms ttl=63
Reply from 172.28.90.201:bytes=32 time=18ms ttl=63
Reply from 172.28.90.201:bytes=32 time=2ms ttl=63ping statistics for 172.28.90.201:
Packets:sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in Milli-seconds:
Minimum = 2ms, Maximum = 38ms, Average = 19ms
Control-c
^c
C:\Documents and settings\administrator>ping 172.28.90.202
Pinging 172.28.90.202 with + bytes of data:
Reply from 172.28.90.202:bytes=32 time=39ms ttl=63
Reply from 172.28.90.202:bytes=32 time=17ms ttl=63
Reply from 172.28.90.202:bytes=32 time=17ms ttl=63