攻城狮科学家

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

一块网卡接SingTel网,一块网卡接公司网

 

1.当配置服务器为外网IP和内网IP的方式时,只设置外网IP的网关,不要设置内网IP的网关.

操作如下: 

1
2
3
4
5
6
7
8
9
10
11
vi /etc/network/interfaces     修改里面的内容如下 
auto eth0 
iface eth0 inet static 
address 192.168.4.213 
netmask 255.255.255.0 
 
auto eth1 
iface eth1 inet static
address 58.200.200.15
netmask 255.255.255.128
gateway 58.200.200.1

注意: 我们没有为 eth0(内部网络) 设置 gateway,保存退出; 

 

2.重启网卡,Ubuntu 重启网卡的命令是: /etc/init.d/networking restart

 

3.手动设置服务器的路由 

 

1
 route add -net 192.168.4.0/24 gw 192.168.4.1 dev eth0

把singtel的内网网段和m2m卡的网段重新路由即可。

注意:手动添加的路由,服务器重启后不生效;可以把上面的语句添加到开机自启动文件中;

posted on 2017-12-27 11:40  攻城狮科学家  阅读(769)  评论(0编辑  收藏  举报