设置多网卡:
• cd /etc/sysconfig/network-scripts下,这个文件夹下有ifcfg-eth0,ifcfg-eth1两个文件(可能更多),这就是两个网卡的配置文件
例如:ifcfg-eth0如下(未添加网关前):
# Intel Corporation 82801G (ICH7 Family) LAN Controller
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:13:72:CE:29:90
IPADDR=192.168.0.110
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
• vi ifcfg-eth0在该网卡中添加,改过后文件:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:13:72:CE:29:90
IPADDR=192.168.0.110
NETMASK=255.255.255.0
NETWORK=192.168.0.0
GATEWAY=X.X.X.X
ONBOOT=yes
TYPE=Ethernet
eth1也同样按照此方法添加网关。
• 然后重启网卡
/etc/rc.d/init.d/network restart
• 设置虚拟网卡的方法
ifconfig eth0:01 192.168.16.237 netmask 255.255.255.0 up