地址和路由配置: /****** A網路由器 ******/ Router-A#conf t(切換到配置狀態) Router-A(config)#int e0(配置Ethernet 0口) Router-A(config-if)#description the LAN port link to my local network(端口說明) Router-A(config-if)#ip add 202.96.199.1 255.255.255.0
(定義以太網IP地址,子網掩碼表示為C類網絡) Router-A(config-if)#no shutdown(激活端口) Router-A(config-if)#exit Router-A(config)#int s0(配置Serial 0口) Router-A(config-if)#description the WAN port link to Router-B(端口說明) Router-A(config-if)#ip add 202.98.0.1 255.255.255.252(定義互聯廣域網IP地址) Router-A(config-if)#bandwidth 128(定義端口速率,單位:kbps) Router-A(config-if)#no shutdown(激活端口) Router-A(config-if)#exit Router-A(config)#ip route 202.97.76.0 255.255.255.224 202.98.0.2 (定義靜態路由,通過網關到達對端局域網絡,IP為對端廣域網IP地址) Router-A(config)#exit Router-A#wr m(保存配置)
/****** B網路由器 ******/ Router-B#conf t Router-B(config)#int e0 Router-B(config-if)#description the LAN port link to my local network(端口說明) Router-B(config-if)#ip add 202.97.76.1 255.255.255.224 (定義以太網IP地址,子網掩碼表示為擁有32個地址的子網) Router-B(config-if)#no shutdown Router-B(config-if)#exit Router-B(config)#int s0 Router-B(config-if)#description the WAN port link to Router-A(端口說明) Router-B(config-if)#ip add 202.98.0.2 255.255.255.252 Router-B(config-if)#bandwidth 128 Router-B(config-if)#no shutdown Router-B(config-if)#exit Router-B(config)#ip route 202.96.199.0 255.255.255.0 202.98.0.1 (定義靜態路由,通過網關到達對端局域網絡,IP為對端廣域網IP地址) Router-B(config)#exit Router-B#wr m(保存配置)
配置完成。
這里是A網、B網路由器配置清單。 Router A: Router-A#sh run Building Configuration... Current configuration version 11.2 service udp-small-servers service tcp-small-servers hostname Router-A enable secret test-a ip subnet-zero interface Ethernet0 description the LAN port link to my local network ip address 202.96.199.1 255.255.255.0 interface Serial0 description the WAN port link to Router-B ip address 202.98.0.1 255.255.255.252 bandwidth 128 interface Serial1 no ip address shutdown ip domain-name xxx.com ip name-server 202.96.199.2 ip name-server 202.96.199.3 ip classless ip route 202.97.76.0 255.255.255.224 202.98.0.2 line con 0 line aux 0 line vty 0 4 password telnet-a login end Router-A# Rouer B: Router-B#sh run Building Configuration... Current configuration version 11.2 service udp-small-servers service tcp-small-servers hostname Router-B enable secret test-b ip subnet-zero interface Ethernet0 description the LAN port link to my local network ip address 202.97.76.1 255.255.255.224 interface Serial0 description the WAN port link to Router-A ip address 202.98.0.2 255.255.255.252 bandwidth 128 interface Serial1 no ip address shutdown ip domain-name yyy.com ip name-server 202.96.199.2 ip name-server 202.96.199.3 ip classless ip route 202.96.199.0 255.255.255.0 202.98.0.1
line con 0 line aux 0 line vty 0 4 password telnet-b login end Router-B#