【Cisco NA】單臂路由+DHCP+DHCP中繼+GRE Tunnel

blob.png


①配置單臂路由  ✔

②在Branch上開啓DHCP,同時PC1、PC2能通過DHCP獲取到IP地址,並且互相能訪問  ✔

③關閉Branch上DHCP並配上DHCP中繼,在server上配置DHCP,實現DHCP跨廣播域服務  ✔

④在Branch和HQ之間開啓GRE,實現PC1和PC2的相互訪問,以及到server的訪問  ✔


PC1


PC1(config)#no ip routing

PC1(config)#int e0/1

PC1(config-if)#ip address dhcp 

PC1(config-if)#no sh

PC1(config-if)#

*Jan  9 10:42:41.280: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Jan  9 10:42:42.286: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

PC1(config-if)#

*Jan  9 10:42:53.504: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/1 assigned DHCP address 10.1.10.1, mask 255.255.255.0, hostname PC1


PC1(config-if)#do ping 10.1.20.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.20.1, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 6/7/9 ms

PC1(config-if)#


PC1>en

PC1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

PC1(config)#int e0/1

PC1(config-if)#no sh

PC1(config-if)#

*Jan 11 05:06:25.069: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Jan 11 05:06:26.075: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

PC1(config-if)#

*Jan 11 05:07:26.080: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/1 assigned DHCP address 10.1.10.1, mask 255.255.255.0, hostname PC1


PC1(config-if)#do ping 172.16.1.100

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/18 ms

PC1(config-if)#do ping 10.1.20.1   

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.20.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/12 ms

PC1(config-if)#


PC2


PC2(config)#no ip routing 

PC2(config)#int e0/1

PC2(config-if)#ip add dhc

PC2(config-if)#ip add dhcp 

PC2(config-if)#no sh

PC2(config-if)#

*Jan  9 10:42:51.872: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Jan  9 10:42:52.872: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

PC2(config-if)#

*Jan  9 10:43:04.188: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/1 assigned DHCP address 10.1.20.1, mask 255.255.255.0, hostname PC2



PC2(config-if)#do ping 10.1.10.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.10.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/14 ms

PC2(config-if)#


PC2>en                                                                                                                                    

PC2#conf t                                                                                                                                

Enter configuration commands, one per line.  End with CNTL/Z.


PC2(config)#int e0/1

PC2(config-if)#no sh 

PC2(config-if)#

*Jan 11 05:07:54.369: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Jan 11 05:07:55.373: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

PC2(config-if)#

*Jan 11 05:07:58.518: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/1 assigned DHCP address 10.1.20.1, mask 255.255.255.0, hostname PC2


PC2(config-if)#end

PC2#ping 

*Jan 11 05:08:04.867: %SYS-5-CONFIG_I: Configured from console by console

PC2#ping 10.1.10.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.10.1, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 5/6/8 ms

PC2#ping 172.16.1.100

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/18 ms

PC2#


SW1


SW1(config)#vlan 10,20

SW1(config-vlan)#exit

SW1(config)#int e0/1

SW1(config-if)#switchport mode access 

SW1(config-if)#switchport access vlan 10

SW1(config-if)#exi

SW1(config)#int range e0/2 - 3

SW1(config-if-range)#switchport trunk encapsulation dot1q 

SW1(config-if-range)#switchport mode trunk 

SW1(config-if-range)#exi

SW1(config)#int e0/0

SW1(config-if)#switchport trunk encapsulation dot1q 

SW1(config-if)#switchport mode trunk 

SW1(config-if)#



SW2


SW2(config)#vlan 10,20

SW2(config-vlan)#exi

SW2(config)#int e0/1

SW2(config-if)#switchport mode access 

SW2(config-if)#switchport access vlan 20

SW2(config-if)#exi

SW2(config)#int 

SW2(config)#interface range ethernet 0/2 - 3

SW2(config-if-range)#switchport trunk encapsulation dot1q 

SW2(config-if-range)#switchport mode trunk 

SW2(config-if-range)#



Branch


Branch(config)#int e0/0.1

Branch(config-subif)#encapsulation dot1Q 10

Branch(config-subif)#ip add 10.1.10.254 255.255.255.0

Branch(config-subif)#exit

Branch(config)#int e0/0.2

Branch(config-subif)#encapsulation dot1Q 20

Branch(config-subif)#ip add 10.1.20.254 255.255.255.0

Branch(config-subif)#exit

Branch(config)#ip dhcp pool vlan 10 

Branch(dhcp-config)#network 10.1.10.0 255.255.255.0

Branch(dhcp-config)#default-router 10.1.10.254

Branch(dhcp-config)#lease 0 0 3

Branch(dhcp-config)#exit 

Branch(config)#ip dhcp pool vlan 20

Branch(dhcp-config)#network 10.1.20.0 255.255.255.0

Branch(dhcp-config)#default-router 10.1.20.254

Branch(dhcp-config)#lease 0 0 3

Branch(dhcp-config)#exit

Branch(config)#int e0/0

Branch(config-if)#no sh

---------------------------------------------------------

Branch#sh run | s dhcp

ip dhcp pool vlan 10

 network 10.1.10.0 255.255.255.0

 default-router 10.1.10.254 

 lease 0 0 3

ip dhcp pool vlan 20

 network 10.1.20.0 255.255.255.0

 default-router 10.1.20.254 

 lease 0 0 3

Branch#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Branch(config)#no ip dhcp pool vlan 10

Branch(config)#no ip dhcp pool vlan 20

Branch(config)#int e0/1

Branch(config-if)#shut

Branch(config-if)#shutdown 

Branch(config-if)#int s4/0

Branch(config-if)#encapsulation ppp

Branch(config-if)#ip add 12.1.1.1 255.255.255.252

Branch(config-if)#no sh

Branch(config-if)#

*Jan 11 04:46:46.292: %LINK-3-UPDOWN: Interface Serial4/0, changed state to up

Branch(config-if)#

*Jan 11 04:46:47.394: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial4/0, changed state to up

Branch(config-if)#

*Jan 11 04:47:10.065: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial4/0, changed state to down

Branch(config-if)#

*Jan 11 04:47:20.070: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial4/0, changed state to up

Branch(config-if)#exit 

Branch(config)#interface tunnel 123

Branch(config-if)#

*Jan 11 04:58:23.363: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel123, changed state to down


Branch(config-if)#tunnel mode gre ip

Branch(config-if)#ip add 10.1.1.1 255.255.255.252

Branch(config-if)#no sh

Branch(config-if)#tunnel source 12.1.1.1

Branch(config-if)#tunnel destination 12.1.1.2

Branch(config-if)#

*Jan 11 05:02:27.005: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel123, changed state to up


Branch(config-if)#do sh run int tun123

Building configuration...


Current configuration : 117 bytes

!

interface Tunnel123

 ip address 10.1.1.1 255.255.255.252

 tunnel source 12.1.1.1

 tunnel destination 12.1.1.2

end


Branch(config-if)#exi

Branch(config)#ip route 172.16.1.0 255.255.255.0 tunnel 123

Branch(config)#int e0/0.1

Branch(config-subif)#ip helper-address 172.16.1.100

Branch(config-subif)#int e0/0.2

Branch(config-subif)#ip helper-address 172.16.1.100

Branch(config-subif)#end

Branch#sh ip 

*Jan 11 05:08:48.857: %SYS-5-CONFIG_I: Configured from console by console

Branch#sh ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override


Gateway of last resort is not set


      10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks

C        10.1.1.0/30 is directly connected, Tunnel123

L        10.1.1.1/32 is directly connected, Tunnel123

C        10.1.10.0/24 is directly connected, Ethernet0/0.1

L        10.1.10.254/32 is directly connected, Ethernet0/0.1

C        10.1.20.0/24 is directly connected, Ethernet0/0.2

L        10.1.20.254/32 is directly connected, Ethernet0/0.2

      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        12.1.1.0/30 is directly connected, Serial4/0

L        12.1.1.1/32 is directly connected, Serial4/0

      172.16.0.0/24 is subnetted, 1 subnets

S        172.16.1.0 is directly connected, Tunnel123







HQ


HQ>en

HQ#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

HQ(config)#int e0/1

HQ(config-if)#shutdown 

HQ(config-if)#int s4/0

HQ(config-if)#encapsulation ppp

HQ(config-if)#ip add 12.1.1.2 255.255.255.252

HQ(config-if)#no sh

HQ(config-if)#

*Jan 11 04:47:17.349: %LINK-3-UPDOWN: Interface Serial4/0, changed state to up

*Jan 11 04:47:18.358: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial4/0, changed state to up

HQ(config-if)#int e0/0

HQ(config-if)#ip add 172.16.1.1 255.255.255.0

HQ(config-if)#no sh

HQ(config-if)#

*Jan 11 04:48:33.405: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Jan 11 04:48:34.410: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

HQ(config-if)#


HQ#conf t

Enter configuration commands, one per line.  End with CNTL/Z.


HQ(config)#int tunnel 123

*Jan 11 05:04:25.351: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel123, changed state to down

HQ(config-if)#tunnel mode gre ip

HQ(config-if)#ip add 10.1.1.2 255.255.255.252

HQ(config-if)#no sh

HQ(config-if)#tunnel source 12.1.1.2

HQ(config-if)#tunnel destination 12.1.1.1

HQ(config-if)#

*Jan 11 05:05:21.114: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel123, changed state to up


HQ(config-if)#exit 


HQ(config)#ip route 10.1.0.0 255.255.0.0 tunnel 123

HQ(config)#do sh ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override


Gateway of last resort is not set


      10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks

S        10.1.0.0/16 is directly connected, Tunnel123

C        10.1.1.0/30 is directly connected, Tunnel123

L        10.1.1.2/32 is directly connected, Tunnel123

      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        12.1.1.0/30 is directly connected, Serial4/0

L        12.1.1.2/32 is directly connected, Serial4/0

      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

C        172.16.1.0/24 is directly connected, Ethernet0/0

L        172.16.1.1/32 is directly connected, Ethernet0/0



Server


Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.


Router(config)#hostname Server

Server(config)#int e0/0

Server(config-if)#ip add 172.16.1.100 255.255.255.0

Server(config-if)#no sh

Server(config-if)#

*Jan 11 04:49:01.941: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Jan 11 04:49:02.941: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up


Server(config-if)#exit 

Server(config)#ip dhcp pool vlan10

Server(dhcp-config)#network 10.1.10.0 255.255.255.0

Server(dhcp-config)#default-router 10.1.10.254

Server(dhcp-config)#lease 0 12

Server(dhcp-config)#exit 

Server(config)#ip dhcp pool vlan20

Server(dhcp-config)#network 10.1.20.0 255.255.255.0

Server(dhcp-config)#default-router 10.1.20.254

Server(dhcp-config)#lease 0 12

Server(dhcp-config)#exit 

Server(config)#ip route 0.0.0.0 0.0.0.0 e0/0 172.16.1.1

Server(config)#end

Server#sh ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override


Gateway of last resort is 172.16.1.1 to network 0.0.0.0


S*    0.0.0.0/0 [1/0] via 172.16.1.1, Ethernet0/0

      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

C        172.16.1.0/24 is directly connected, Ethernet0/0

L        172.16.1.100/32 is directly connected, Ethernet0/0



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章