2024年4月23日发(作者:)
路由器学习
2511 配置路由器各端口IP地址(前提:设好本机IP和网关,consele 接口为反转线即配置
线,两台路由器连接为背对背电缆线)
RouteA>enable
RouteA#config t
RouteA(config)#interface ethernet 0 (进入Ethernet 端口)
RouteA(config-ethernet)#ip address 子网掩码 (注意:一定要No
shutdown,使端口开启)
RouteA(config-ethernet)#no shutdown
RouteA(config-ethernet)#exit
RouteA(config)#interface serial 1 (1表示广域网使用的端口号,如果背对背电缆线是插在wan
2上,则用2)
RouteA(config-serial1)#ip address 子网掩码 (注意:一定要No shutdown,
使端口开启)
RouteA(config-serial1)#no shutdown
RouteA(config-serial1)#show run
RouteB>enable
RouteB#config t
RouteB(config)#interface ethernet 0 (进入Ethernet 端口)
RouteB(config-ethernet)#ip address 子网掩码 (注意:一定要No
shutdown,使端口开启)
RouteB(config-ethernet)#no shutdown
RouteB(config-ethernet)#exit
RouteB(config)#interface serial 1 (1表示广域网使用的端口号,如果背对背电缆线是插在2,
则用2)
RouteB(config-serial1)#ip address 子网掩码 (注意:一定要No shutdown,
使端口开启)
RouteB(config-serial1)#no shutdown
静态路由
RouteA(config)#ip route 要到达的网段 子网掩码 路由下一跳地址
RouteB(config)#ip route 要到达的网段 子网掩码 路由下一跳地址
取消静态路由
Route(config)#no ip route 要到达的网段 子网掩码 路由下一跳地址
动态(RIP)
RouteA>enable
RouteA#config t
RouteA(config)#interface ethernet 0 (进入Ethernet 端口)
RouteA(config-ethernet)#ip address 子网掩码 (注意:一定要No
1
shutdown,使端口开启)
RouteA(config-ethernet)#no shutdown
RouteA(config-ethernet)#exit
RouteA(config)#interface serial 1 (1表示广域网使用的端口号,如果背对背电缆线是插在2,
则用2)
RouteA(config-serial1)#ip address 子网掩码 (注意:一定要No shutdown,
使端口开启)
RouteA(config-serial1)#no shutdown
RouteA(config)#router rip
RouteA(config-rip)#neighbour 内部Ethernet网段
RouteA(config-rip)#neighbour 路由器连接的公共网段
RouteA(config-rip)#version 2 (表示RIP的版本可以输入1 或者 2)
RouteA(config-rip)#exit
RouteA(config)#interface serial 1
RouteA(config-serial1)#ip rip work
RouteB>enable
RouteB#config t
RouteB(config)#interface ethernet 0 (进入Ethernet 端口)
RouteB(config-ethernet)#ip address 子网掩码 (注意:一定要No
shutdown,使端口开启)
RouteB(config-ethernet)#no shutdown
RouteB(config-ethernet)#exit
RouteB(config)#interface serial 1 (1表示广域网使用的端口号,如果背对背电缆线是插在2,
则用2)
RouteB(config-serial1)#ip address 子网掩码 (注意:一定要No shutdown,
使端口开启)
RouteB(config-serial1)#no shutdown
RouteB(config)#router rip
RouteB(config-rip)#neighbour 内部Ethernet网段
RouteB(config-rip)#neighbour 路由器连接的公共网段
RouteB(config-rip)#version 2 (表示RIP的版本可以输入1 或者 2)
RouteB(config-rip)#exit
RouteB(config)#interface serial 1
RouteB(config-serial1)#ip rip work
恢复出厂默认值:
Route#first-config
Route#write
Route#reboot
查看路由表
Route#show ip route
2
查看接口信息
Route#show interface ethernet 0 或者 show interface serial 1 / 2
OSPf
RouteA>enable
RouteA#config t
RouteA(config)#interface ethernet 0 (进入Ethernet 端口)
RouteA(config-ethernet)#ip address 子网掩码 (注意:一定要No
shutdown,使端口开启)
RouteA(config-ethernet)#no shutdown
RouteA(config-ethernet)#exit
RouteA(config)#interface serial 1 (1表示广域网使用的端口号,如果背对背电缆线是插在2,
则用2)
RouteA(config-serial1)#ip address 子网掩码 (注意:一定要No shutdown,
使端口开启)
RouteA(config-serial1)#no shutdown
RouteA(config)#router ospf
RouteA(config-rip)#network 内部Ethernet网段 子网掩码 area 1 (自治域号1-6535)
RouteA(config-rip)#network 路由器连接的公共网段 子网掩码 area 1 (自治域号)
RouteA(config-rip)#exit
RouteA(config)#interface ethernet 0
RouteA(config-ethernet)#ip ospf enable area 1( 开启)
RouteA(config-ethernet)#exit
RouteA(config)#interface serial 1
RouteA(config-serial1)#ip ospf enable area 1
RouteA(config-serial1)#exit
RouteB>enable
RouteB#config t
RouteB(config)#interface ethernet 0 (进入Ethernet 端口)
RouteB(config-ethernet)#ip address 子网掩码 (注意:一定要No
shutdown,使端口开启)
RouteB(config-ethernet)#no shutdown
RouteB(config-ethernet)#exit
RouteB(config)#interface serial 1 (1表示广域网使用的端口号,如果背对背电缆线是插在2,
则用2)
RouteB(config-serial1)#ip address 子网掩码 (注意:一定要No shutdown,
使端口开启)
RouteB(config-serial1)#no shutdown
RouteB(config)#router ospf
RouteB(config-rip)#network 内部Ethernet网段 子网掩码 area 1 (自治域号)
RouteB(config-rip)#neighbour 路由器连接的公共网段 子网掩码 area 1 (自治域号)
RouteB(config-rip)#exit
3
RouteB(config)#interface ethernet 0
RouteB(config-ethernet)#ip ospf enable area 1
RouteB(config-ethernet)#exit
RouteB(config)#interface serial 1
RouteB(config-serial1)#ip ospf enable area 1
RouteB(config-serial1)#exit
4
发布评论