當前位置:首頁 » 操作系統 » 在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指令。

熱點內容
編譯原理沖突圖的定義 發布:2025-09-16 21:26:45 瀏覽:802
安卓手機芯哪個牌子好 發布:2025-09-16 21:26:33 瀏覽:200
centos編譯安裝git 發布:2025-09-16 21:19:55 瀏覽:968
安卓系統如何使用手機優盤 發布:2025-09-16 21:14:01 瀏覽:325
在手機上注冊公積金如何設置密碼 發布:2025-09-16 21:07:01 瀏覽:817
無控制器存儲 發布:2025-09-16 21:02:44 瀏覽:710
陰陽師ios清理緩存 發布:2025-09-16 21:02:35 瀏覽:511
人人網訪問記錄 發布:2025-09-16 20:53:46 瀏覽:382
oracle資料庫實例 發布:2025-09-16 20:23:04 瀏覽:561
java實習心得體會 發布:2025-09-16 20:06:46 瀏覽:593