单网卡配置多个IP

使用一个网卡配置多个IP地址

 

一、Linux操作系统

 

1、永久配置

[root@eccs_web network-scripts]# cd /etc/sysconfig/network-scripts

[root@eccs_web network-scripts]# cp ifcfg-eth0 ifcfg-eth0:0

[root@eccs_web network-scripts]# vi ifcfg-eth0:0

DEVICE=eth0:0 #需要将原来的eth0改为eth0:0
HWADDR=00:0c:29:8e:a7:06 #这个不能改变
TYPE=Ethernet
UUID=9e7044ec-ef90-4f4d-a6d0-c72f3f168404
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
IPADDR=192.168.1.99 #新的IP地址
NETMASK=255.255.255.0

[root@eccs_web network-scripts]# service network restart


[root@eccs_web network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:8E:A7:06
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe8e:a706/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13912 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16406 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5965566 (5.6 MiB)  TX bytes:1514019 (1.4 MiB)

eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:8E:A7:06
          inet addr:192.168.1.99  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

 

 2、临时配置

[root@eccs_web network-scripts]# ifconfig eth0:1 192.168.1.88

 

二、windows 操作系统

 

 

 

猜你喜欢

转载自hbiao68.iteye.com/blog/2166563