Linux双网关配置问题。

为了一个网络设置折腾,今天用虚拟机增加两个网卡对应PC主机上的两个网卡,开始进行虚拟机配置,

eth0      Link encap:Ethernet  HWaddr 00:0c:29:db:f8:a0  
          inet addr:192.168.1.75  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fedb:f8a0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:63 errors:0 dropped:0 overruns:0 frame:0
          TX packets:471 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4811 (4.8 KB)  TX bytes:62529 (62.5 KB)
          Interrupt:19 Base address:0x2024 


eth1      Link encap:Ethernet  HWaddr 00:0c:29:db:f8:aa  
          inet addr:192.168.14.185  Bcast:192.168.14.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fedb:f8aa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2119 errors:0 dropped:0 overruns:0 frame:0
          TX packets:582 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:215731 (215.7 KB)  TX bytes:69193 (69.1 KB)
          Interrupt:19 Base address:0x20a4 


lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:478 errors:0 dropped:0 overruns:0 frame:0
          TX packets:478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:40640 (40.6 KB)  TX bytes:40640 (40.6 KB)

eth0 192.168.1.75这个事内网网卡,

eth1 192.168.14.185这个是外网网卡。

刚开始ping www.baidu.com的时候一直出现ping不通。

无法上网。

后面通过网络查询发现时route出现问题了,

问题之前的route:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
192.168.14.0    0.0.0.0         255.255.255.0   U     1      0        0 eth1

解决问题之后的route:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.14.1    0.0.0.0         UG    0      0        0 eth1
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0

前后之间可以看出问题。

这里只不过需要增加一个网关:route add default gw 192.168.14.1

所以可以访问外部网络。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值