linux下新增路由表

2021-05-09 20:42:56 字數 911 閱讀 2604

# redhat-config-network

/* 使用ifconfig命令配置並檢視網路介面情況 */

//配置eth0的ip,同時啟用裝置

# ifconfig eth0 192.168.168.119 netmask 255.255.255.0 up

//配置eth0別名裝置 eth0:1 的ip,並新增路由

# ifconfig eth0:1 192.168.168.110

# route add –host 192.168.168.110 dev eth0:1

//啟用(禁用)裝置

# ifconfig eth0:1 up(down)

//檢視所有(指定)網路介面配置

# ifconfig (eth0)

/* 使用route 命令配置路由表 */

//新增到主機路由

# route add –host 192.168.168.110 dev eth0:1

# 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:1

/* 常用命令 */

# traceroute

www.pconline.com.cn

# ping

www.pconline.com.cn

Linux 如何新增路由表

linux下靜態路由修改命令 方法一 新增路由 route add net 192.168.0.0 24 gw 192.168.0.1 route add host 192.168.1.1 dev 192.168.0.1 刪除路由 route del net 192.168.0.0 24 gw 19...

linux路由表配置

1 路由表 table 從0到255進行編號,每個編號可以對應乙個別名,編號和別名的對應關係在linux下放在 etc iproute2 rt tables這個檔案裡,一般0編號的table對應的別名為upspec,255編號對應的別名為local,254和253對應的別名分別為main和defau...

Linux路由表實現 1

今天開始學習kernel中的路由表fib的實現,kernel支援兩種fib的儲存方式 一種是hash,另外一種是單詞查詢樹trie。分別由編譯選項config ip fib hash和config ip fib trie決定。據說新版本的kernel已經去掉了hash的實現方式 下面首先看一下fib...