目录
1、静态路由
2、默认路由:
3、浮动路由:
1、静态路由
拓扑图:
配置文件:
R1
#
interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ip route-static 3.3.3.3 255.255.255.255 10.1.1.2
ip route-static 10.1.2.0 255.255.255.0 10.1.1.2
R2
#
interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.2.2 255.255.255.0
#
ip route-static 1.1.1.1 255.255.255.255 10.1.1.1
ip route-static 3.3.3.3 255.255.255.255 10.1.2.1
R3
#
interface GigabitEthernet0/0/0
ip address 10.1.2.1 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ip route-static 1.1.1.1 255.255.255.255 10.1.2.2
ip route-static 10.1.1.0 255.255.255.0 10.1.2.2
2、默认路由:
拓扑图:
配置文件:
R1
#
interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 10.1.1.2
R2
#
interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.2.2 255.255.255.0
#
ip route-static 1.1.1.1 255.255.255.255 10.1.1.1
ip route-static 3.3.3.3 255.255.255.255 10.1.2.1
R3
#
interface GigabitEthernet0/0/0
ip address 10.1.2.1 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 10.1.2.2
3、浮动路由:
拓扑图:
配置文件:
R1
#
interface Ethernet0/0/0
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 10.1.1.2
ip route-static 0.0.0.0 0.0.0.0 10.1.3.2 preference 61
R2
#
interface Ethernet0/0/0
ip address 10.1.3.2 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.2.2 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.1.3.1 preference 61
ip route-static 1.1.1.1 255.255.255.255 10.1.1.1
ip route-static 3.3.3.3 255.255.255.255 10.1.2.1
R3
#
interface GigabitEthernet0/0/0
ip address 10.1.2.1 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 10.1.2.2