1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > CentOS双网卡双IP设置

CentOS双网卡双IP设置

时间:2021-12-26 12:20:52

相关推荐

CentOS双网卡双IP设置

CentOS双网卡双IP设置

系统环境:CentOS Linux

网络环境: 两个IP地址,192.168.0.10和10.10.30.2,掩码是255.255.255.0,

这两个子网的网关地址分别是192.168.0.1和10.10.30.1。

1. 为网卡eth0配置ip地址192.168.0.10,为网卡eth1配置ip地址为10.10.30.2配置文件为:

/etc/sysconfig/network-scripts/ifcfg-eth0

/etc/sysconfig/network-scripts/ifcfg-eth1

2. 配置默认网关为任意一个。这个默认网关,决定了系统主动去使用网络时,使用的接口。

配置文件:/etc/sysconfig/network

3. 编辑路由表

修改/etc/iproute2/rt_tables,添加内容:

252 net2

251 net3

#/etc/rc.local添加原路返回路由

iprouteflush table net2

ip route add default via 192.168.0.1 dev eth0 src 192.168.0.10 table net2

ip rule add from 192.168.0.10 table net2

ip route flush table net3

ip route add default via 10.10.30.1 dev eth1 src 10.10.30.2 table net3

ip rule add from 10.10.30.2 table net3

本文来自于中国蓝客联盟

本文来自:Linux学习网

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。