当前位置:首页 » 操作系统 » 在linux添加路由

在linux添加路由

发布时间: 2022-06-20 18:41:09

linux怎么添加静态路由

linux下添加路由的方法:
一:使用 route 命令添加
使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法:
//添加到主机的路由
# route add –host 192.168.168.110 dev eth0
# route add –host 192.168.168.119 gw 192.168.168.1
//添加到网络的路由
# route add –net IP netmask MASK eth0
# route add –net IP netmask MASK gw IP
# route add –net IP/24 eth1
//添加默认网关
# route add default gw IP
//删除路由
# route del –host 192.168.168.110 dev eth0

二:在linux下设置永久路由的方法:
1.在/etc/rc.local里添加
方法:
route add -net 192.168.3.0/24 dev eth0
route add -net 192.168.2.0/24 gw 192.168.3.254

2.在/etc/sysconfig/network里添加到末尾
方法:GATEWAY=gw-ip 或者 GATEWAY=gw-dev

3./etc/sysconfig/static-router :
any net x.x.x.x/24 gw y.y.y.y

⑵ linux如何配置路由

linux下添加路由的方法:
一:使用 route 命令添加
使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法:
//添加到主机的路由
# route add –host 192.168.168.110 dev eth0
# route add –host 192.168.168.119 gw 192.168.168.1
//添加到网络的路由
# route add –net IP netmask MASK eth0
# route add –net IP netmask MASK gw IP
# route add –net IP/24 eth1
//添加默认网关
# route add default gw IP
//删除路由
# route del –host 192.168.168.110 dev eth0

二:在linux下设置永久路由的方法:
1.在/etc/rc.local里添加
方法:
route add -net 192.168.3.0/24 dev eth0
route add -net 192.168.2.0/24 gw 192.168.3.254

2.在/etc/sysconfig/network里添加到末尾
方法:GATEWAY=gw-ip 或者 GATEWAY=gw-dev

3./etc/sysconfig/static-router :
any net x.x.x.x/24 gw y.y.y.y

⑶ Linux怎么添加静态路由

一:使用 route 命令添加 使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法: //添加到主机的路由 # route add –host 192.168.168.110 dev eth0 # route add –host 192.168.168.119 gw 192.168.168.1 //添加到网络的路由 # route add –net IP netmask MASK eth0 # route add –net IP netmask MASK gw IP # route add –net IP/24 eth1 //添加默认网关 # route add default gw IP//删除路由# route del –host 192.168.168.110 dev eth0 二:在linux下设置永久路由的方法: 1.在/etc/rc.local里添加方法:route add -net 192.168.3.0/24 dev eth0

⑷ linux下添加路由列表

这个问题看似简单,实际有点复杂。首先要根据你的网络状况决定采用那种方式实现路由:
1。网络里面有路由器,那么在路由器上做路由就行了。
2。没有路由器,但服务器上有两个网卡,那么一个网卡封装10的ip,一个网段封装192的ip,然后加上路由指令即可。
3。服务器只有一块网卡,也能实现,可以用自端口方式给网卡封装两个ip,然后加上路由即可。

⑸ linux怎么添加静态路由

linux下添加路由的方法:
一:使用 route 命令添加使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了。

# route del –host 192.168.168.110 dev eth0
二:在linux下设置永久路由的方法:
1.在/etc/rc.local里添加方法:
route add -net 192.168.3.0/24 dev eth0
route add -net 192.168.2.0/24 gw 192.168.3.254
2.在/etc/sysconfig/network里添加到末尾
方法:GATEWAY=gw-ip 或者 GATEWAY=gw-dev
3./etc/sysconfig/static-router :
any net x.x.x.x/24 gw y.y.y.y

⑹ Linux怎么添加静态路由

平时工作经常需要配置路由,接下来总结一下linux服务器配置路由的方法。

1、首先看一下本机的网路环境网络信息及路由信息:ip addr;route -n。

⑺ linux如何添加路由

⑻ linux里怎么永久性添加路由

如果是添加网关的话,在
/etc/sysconfig/network文件中指定GATEWAY,
例如:
GATEWAY=192.168.0.254

如果要添加路由的话,
在/etc/rc.d/rc.local中添加一行(例子):
route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.254 dev eth1

⑼ linux添加静态路由

linux下添加路由的方法:
一:使用 route 命令添加
使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法:
//添加到主机的路由
# route add –host 192.168.168.110 dev eth0
# route add –host 192.168.168.119 gw 192.168.168.1
//添加到网络的路由
# route add –net IP netmask MASK eth0
# route add –net IP netmask MASK gw IP
# route add –net IP/24 eth1
//添加默认网关
# route add default gw IP
//删除路由
# route del –host 192.168.168.110 dev eth0

二:在linux下设置永久路由的方法:
1.在/etc/rc.local里添加
方法:
route add -net 192.168.3.0/24 dev eth0
route add -net 192.168.2.0/24 gw 192.168.3.254

2.在/etc/sysconfig/network里添加到末尾
方法:GATEWAY=gw-ip 或者 GATEWAY=gw-dev

3./etc/sysconfig/static-router :
any net x.x.x.x/24 gw y.y.y.y
满意请采纳。

⑽ linux 添加默认路由

1、首先,连接相应linux主机,进入到linux命令行状态下,等待输入shell指令。

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:644
制作脚本网站 发布:2025-10-20 08:17:34 浏览:934
python中的init方法 发布:2025-10-20 08:17:33 浏览:631
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:820
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:730
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:1065
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:297
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:158
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:849
python股票数据获取 发布:2025-10-20 07:39:44 浏览:762