查看路由表:show ip route
// route0配置端口ip
en
conf t
int f0/0
ip address 192.168.1.254 255.255.255.0
no shutdown
exit
int se1/0
ip address 172.168.1.1 255.255.255.0
no shutdown
exit
// route1配置端口ip
en
conf t
int f0/0
ip address 192.168.2.254 255.255.255.0
no shutdown
exit
int se1/0
ip address 172.168.1.2 255.255.255.0
no shutdown
clock rate 64000
exit
静态路由配置
为路由表添加目标地址的路径
// 配置路由表
// ip route 目标地址 下一跳地址(或路由器出口端口号)
// route 0
ip route 192.168.2.0 255.255.255.0 172.168.1.2
// route 1
ip route 192.168.1.0 255.255.255.0 172.168.1.1
动态路由配置(单区域OSPF配置)
为路由表添加本路由器所有连接的网段
// route 0
route ospf 1 //启用ospf协议,进程号为1
network 192.168.1.0 0.0.0.255 area 0 // 当前连接网段,反掩码,单区域号为0
network 172.168.1.0 0.0.0.255 area 0
// route 1
route ospf 1 //启用ospf协议,进程号为1,与route0一致
network 192.168.1.0 0.0.0.255 area 0 // 当前连接网段,反掩码,单区域号为0
network 172.168.1.0 0.0.0.255 area 0
网友评论