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

熱點內容
scratch少兒編程課程 發布:2025-04-16 17:11:44 瀏覽:642
榮耀x10從哪裡設置密碼 發布:2025-04-16 17:11:43 瀏覽:368
java從入門到精通視頻 發布:2025-04-16 17:11:43 瀏覽:89
php微信介面教程 發布:2025-04-16 17:07:30 瀏覽:312
android實現陰影 發布:2025-04-16 16:50:08 瀏覽:795
粉筆直播課緩存 發布:2025-04-16 16:31:21 瀏覽:348
機頂盒都有什麼配置 發布:2025-04-16 16:24:37 瀏覽:213
編寫手游反編譯都需要學習什麼 發布:2025-04-16 16:19:36 瀏覽:819
proteus編譯文件位置 發布:2025-04-16 16:18:44 瀏覽:369
土壓縮的本質 發布:2025-04-16 16:13:21 瀏覽:596