单个网卡,一个公网,一个内网ip的设置,可以参考下面的例子。
OS Version: Centos 6.X
Ethernet example:
# pwd
/etc/sysconfig/network-scripts
# ls
ifcfg-eth0 ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-wireless network-functions
ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifup ifup-eth ifup-isdn ifup-post ifup-sit init.ipv6-global network-functions-ipv6
ifdown ifdown-ippp ifdown-post ifdown-sit ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-tunnel net.hotplug
# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
UUID="6087c18c-519d-4a0f-b6b0-1fb89f986791"
HWADDR=44:87:FC:79:3F:62
IPADDR=******
PREFIX=29
GATEWAY=********
IPADDR2=10.12.7.109
PREFIX2=24
GATEWAY2=10.12.7.1
DNS1=************
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
OS Version: Centos 6.X
Ethernet example:
# pwd
/etc/sysconfig/network-scripts
# ls
ifcfg-eth0 ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-wireless network-functions
ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifup ifup-eth ifup-isdn ifup-post ifup-sit init.ipv6-global network-functions-ipv6
ifdown ifdown-ippp ifdown-post ifdown-sit ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-tunnel net.hotplug
# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
UUID="6087c18c-519d-4a0f-b6b0-1fb89f986791"
HWADDR=44:87:FC:79:3F:62
IPADDR=******
PREFIX=29
GATEWAY=********
IPADDR2=10.12.7.109
PREFIX2=24
GATEWAY2=10.12.7.1
DNS1=************
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"