linux centos 多网络配置

/etc/sysconfig/network-scripts

ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

UUID=c963ebdd-4e0f-46ff-9272-4a99a3ab980f

ONBOOT=yes

NM_CONTROLLED=yes

IPADDR=192.168.0.104

NETMASK=255.255.255.0

BOOTPROTO=static

GATEWAY=192.168.0.1

DNS1=8.8.8.8

DNS2=8.8.4.4

ifcfg-eth1

DEVICE=eth1

NM_CONTROLLED="yes"

ONBOOT="yes"

BOOTPROTO="dhcp"

DNS1=8.8.8.8

DNS2=8.8.4.4

ifcfg-eth2

DEVICE=eth2

NM_CONTROLLED="yes"

ONBOOT="yes"

BOOTPROTO="dhcp"

DNS1=8.8.8.8

DNS2=8.8.4.4

route-eth1

#!/bin/bash

routeadddefaultdeveth1

#routeadd192.168.56.1/24deveth0

/etc/resolf.conf

;generatedby/sbin/dhclient-script

searchxxx.comyingsan2

nameserver8.8.8.8

nameserver8.8.4.4

注:

1、必要时需要删除文件rm-f/etc/udev/rules.d/70-persistent-net.rules

(更换网卡时)

2、需要上公网时,需要考虑route

routedeldefaulteth0

routeadddefaulteth1