博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ubuntu配置多网,网关不起作用的问题
阅读量:4482 次
发布时间:2019-06-08

本文共 1007 字,大约阅读时间需要 3 分钟。

在/etc/network/interfaces 中设置网络

 

auto eth0iface eth0 inet staticaddress 192.168.50.1gateway 192.168.50.1netmask 255.255.255.0auto eth1iface eth1 inet staticaddress 192.168.100.150gateway 192.168.100.1netmask 255.255.255.0dns-nameservers 114.114.114.114

 

结果启动之后默认网关为192.168.50.1

$route

显示如下

$default 192.168.50.1 。。。

真正需要的网关是192.168.100.1

将上述代码修改一下即可

auto eth0iface eth0 inet staticaddress 192.168.50.1#gateway 192.168.50.1netmask 255.255.255.0auto eth1iface eth1 inet staticaddress 192.168.100.150gateway 192.168.100.1netmask 255.255.255.0dns-nameservers 114.114.114.114

 

另外一种配置方式为:

auto eth0iface eth0 inet staticaddress 192.168.50.1#gateway 192.168.50.1netmask 255.255.255.0auto eth1iface eth1 inet staticaddress 192.168.100.150#gateway 192.168.100.1netmask 255.255.255.0#dns-nameservers 114.114.114.114up route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.100.1 dev eth1up route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.100.1 dev eth1

 

转载于:https://www.cnblogs.com/yasmi/p/4860758.html

你可能感兴趣的文章
创建ORACLE 查询用户
查看>>
jzoj3297. 【SDOI2013】逃考
查看>>
通过例子学python(2.1)
查看>>
高效率场景-内存映射
查看>>
Python基础——0前言
查看>>
机器学习三剑客之Numpy
查看>>
django路由转发
查看>>
HBase环境搭建随笔
查看>>
SAX vs. DOM (Event vs. Tree)
查看>>
堆排序原理及算法实现(最大堆)
查看>>
说说无线路由器后门的那些事儿(1)-D-Link篇
查看>>
AJAX POST&跨域 解决方案 - CORS
查看>>
C#基础之接口
查看>>
nio 序列化
查看>>
Hadoop集群时钟同步
查看>>
C++二维数组讲解、二维数组的声明和初始化
查看>>
纹理映射和混合
查看>>
PHP获取域名、IP地址的方法
查看>>
php验证复选框的小例子
查看>>
Sql Server 判断表或数据库是否存在
查看>>