路由器基础配置之静态路由

路由器基础配置之静态路由

我们将以上面的拓扑图进行静态路由的实验,实验目的是达到全网互通的效果

所谓静态路由的下一跳也就是指定自己所在的路由器相邻路由器的那个离你最近的接口,以router0为例,相邻的路由器为router1,离router0最近的router1的接口是router1上的s0/3/0,这就是router0的下一跳所在

router0:

enbale  进入特权模式

config t  进入全局配置模式

interface l0(这里是L0)设置回环的ip地址

ip address 192.168.1.1 255.255.255.0

exit

interface s0/3/0

ip address 192.168.10.1 255.255.255.0

clock rate 6400 (配置的DCE串口,设置同步时间)

no shutdown

exit

在全局配置模式下配置静态路由

ip route 192.168.2.0 255.255.255.0 192.168.10.2(你要去的目标网段和指定的下一跳的ip)

ip route 192.168.20.0 255.255.255.0 192.168.10.2

ip route 192.168.3.0 255.255.255.0 192.168.10.2

router1:

enbale  进入特权模式

config t  进入全局配置模式

interface l0(这里是L0)设置回环的ip地址

ip address 192.168.2.1 255.255.255.0

exit

interface s0/3/1

ip address 192.168.20.1 255.255.255.0

clock rate 6400 (配置的DCE串口,设置同步时间)

no shutdown

exit

interface s0/3/0

ip address 192.168.10.2 255.255.255.0

no shutdown

exit

在全局配置模式下配置静态路由

ip route 192.168.1.0 255.255.255.0 192.168.10.1(你要去的目标网段和指定的下一跳的ip)

ip route 192.168.3.0 255.255.255.0 192.168.20.2

router3:

enbale  进入特权模式

config t  进入全局配置模式

interface l0(这里是L0)设置回环的ip地址

ip address 192.168.3.1 255.255.255.0

exit

interface s0/3/1

ip address 192.168.20.2 255.255.255.0

no shutdown

exit

在全局配置模式下配置静态路由

ip route 192.168.2.0 255.255.255.0 192.168.20.1(你要去的目标网段和指定的下一跳的ip)

ip route 192.168.10.0 255.255.255.0 192.168.20.1

ip route 192.168.1.0 255.255.255.0 192.168.20.1

这样全网互通就完成了!