锐捷网络实训三(NAT配置)

实训项目三

任务清单

基础配置

根据实训项目 3-拓扑图和实训项目 3-地址规划表上要求,为每一个PC和接口配置IP地址。

默认路由配置

在出口路由器上配置默认路由,让它能够访问外网,并且在Internet设备上也写一条默认路由指向出口路由器。

NAT配置

在出口路由器上配置NAPT,使PC能够PING通外网的100.1.1.1。

锐捷网络实训三(NAT配置)_第1张图片

设备名称

端口号

IP地址

VPC

eth0

172.16.47.1/24

R1

G0/1

172.16.47.254/24

R1

G0/0

192.168.2.1/24

Inter

G0/0

192.168.2.2/24

Inter

LoopBack

100.1.1.1/32

下面是每个设备的配置和配置验证截图,一般第一张是配置,有"show"开始为验证截图。最后有一个验证拓扑图各功能ping通的验证。 

pc

VPCS> ip 172.16.47.1 24 172.16.47.254
Checking for duplicate address...
VPCS : 172.16.47.1 255.255.255.0 gateway 172.16.47.254
VPCS> show ip

NAME        : VPCS[1]
IP/MASK     : 172.16.47.1/24
GATEWAY     : 172.16.47.254
DNS         : 
MAC         : 00:50:79:66:68:15
LPORT       : 20000
RHOST:PORT  : 127.0.0.1:30000
MTU         : 1500

VPCS> 

R1

Ruijie>en
Password:******
User's password is too weak. Please change the password!
Ruijie#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

Ruijie(config)#int g0/1    //进入g0/1
Ruijie(config-if-GigabitEthernet 0/1)#no switchport //开启路由功能
Ruijie(config-if-GigabitEthernet 0/1)#ip address 172.16.47.254 24 //配置IP地址

Ruijie(config-if-GigabitEthernet 0/1)#int g0/0
Ruijie(config-if-GigabitEthernet 0/0)#no switchport 
Ruijie(config-if-GigabitEthernet 0/0)#ip address 192.168.2.1 24

Ruijie(config-if-GigabitEthernet 0/0)#exit

Ruijie(config)#access-list 1 permit 172.16.47.0 0.0.0.255 //配置ACL 1,允许172.16.47.0/24
Ruijie(config)#access-list 1 deny any //拒绝其他

Ruijie(config)#ip nat pool ssj 192.168.2.1 192.168.2.1 netmask 255.255.255.0
                                                                    //配置NAT地址池
Ruijie(config)#int g0/1
Ruijie(config-if-GigabitEthernet 0/1)#ip nat inside //设置为内网口

Ruijie(config-if-GigabitEthernet 0/1)#int g0/0
Ruijie(config-if-GigabitEthernet 0/0)#ip nat outside //设置为外网口

Ruijie(config-if-GigabitEthernet 0/0)#exit

Ruijie(config)#ip nat inside source list 1 pool ssj overload //把ACL和NAT地址池关联

Ruijie(config)#hostname R1

R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2 //配置默认路由

R1(config)#exit
R1#wr
R1#show ip int br
Interface                                IP-Address(Pri)      IP-Address(Sec)      Status                 Protocol 
GigabitEthernet 0/0                      192.168.2.1/24       no address           up                     up       
GigabitEthernet 0/1                      172.16.47.254/24     no address           up                     up       
VLAN 1                                   no address           no address           up                     down     

R1#show run
...
ip access-list standard 1
 10 permit 172.16.47.0 0.0.0.255 
 20 deny any 
...
interface GigabitEthernet 0/0
 no switchport
 ip address 192.168.2.1 255.255.255.0
 ip nat outside
!
interface GigabitEthernet 0/1
 no switchport
 ip address 172.16.47.254 255.255.255.0
 ip nat inside
...
ip nat pool ssj 192.168.2.1 192.168.2.1 netmask 255.255.255.0
ip nat inside source list 1 pool ssj overload
...
end

R1#show ip route

Codes:  C - Connected, L - Local, S - Static
        R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
        IA - Inter area, EV - BGP EVPN, A - Arp to host
        LA - Local aggregate route
        * - candidate default

Gateway of last resort is 192.168.2.2 to network 0.0.0.0
S*    0.0.0.0/0 [1/0] via 192.168.2.2
C     172.16.47.0/24 is directly connected, GigabitEthernet 0/1
C     172.16.47.254/32 is local host. 
C     192.168.2.0/24 is directly connected, GigabitEthernet 0/0
C     192.168.2.1/32 is local host. 
R1#

 Inter

Ruijie>en
Password:******
User's password is too weak. Please change the password!
Ruijie#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Ruijie(config)#host Inter

Inter(config)#int g0/0
Inter(config-if-GigabitEthernet 0/0)#ip add 192.168.2.2 24 //配置IP

Inter(config-if-GigabitEthernet 0/0)#exit  
  
Inter(config)#int loopback 0 //进入环回口0
Inter(config-if-Loopback 0)#ip address 100.1.1.1 32 //配置IP
Inter(config-if-Loopback 0)#exit

Inter(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1 //配置去往内网的默认路由

Inter(config)#exit
Inter#wr
Inter#show ip int br
Interface                                IP-Address(Pri)      IP-Address(Sec)      Status                 Protocol 
GigabitEthernet 0/0                      192.168.2.2/24        no address           up                     up       
Loopback 0                               100.1.1.1/32         no address           up                     up       
VLAN 1  

Inter#show run
...
interface Loopback 0
 ip address 100.1.1.1 255.255.255.255
...
end

Inter#show ip route

Codes:  C - Connected, L - Local, S - Static
        R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
        IA - Inter area, EV - BGP EVPN, A - Arp to host
        LA - Local aggregate route
        * - candidate default

Gateway of last resort is no set
C     100.1.1.1/32 is local host. 
C     192.16.2.0/24 is directly connected, GigabitEthernet 0/0
C     192.16.2.2/32 is local host. 

验证截图

R1#show ip int br
Interface                                IP-Address(Pri)      IP-Address(Sec)      Status                 Protocol 
GigabitEthernet 0/0                      192.168.2.1/24       no address           up                     up       
GigabitEthernet 0/1                      172.16.47.254/24     no address           up                     up       
VLAN 1                                   no address           no address           up                     down     

R1#show ip route

Codes:  C - Connected, L - Local, S - Static
        R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
        IA - Inter area, EV - BGP EVPN, A - Arp to host
        LA - Local aggregate route
        * - candidate default

Gateway of last resort is 192.168.2.2 to network 0.0.0.0
S*    0.0.0.0/0 [1/0] via 192.168.2.2
C     172.16.47.0/24 is directly connected, GigabitEthernet 0/1
C     172.16.47.254/32 is local host. 
C     192.168.2.0/24 is directly connected, GigabitEthernet 0/0
C     192.168.2.1/32 is local host. 

R1#show access-lists 

ip access-list standard 1
 10 permit 172.16.47.0 0.0.0.255 
 20 deny any 

R1#show ip nat translations 
Pro  Inside global         Inside local          Outside local         Outside global        
icmp 192.168.2.1:26948     172.16.47.1:26948     100.1.1.1             100.1.1.1             
icmp 192.168.2.1:26180     172.16.47.1:26180     100.1.1.1             100.1.1.1             
icmp 192.168.2.1:25924     172.16.47.1:25924     100.1.1.1             100.1.1.1             
icmp 192.168.2.1:26436     172.16.47.1:26436     100.1.1.1             100.1.1.1             
icmp 192.168.2.1:26692     172.16.47.1:26692     100.1.1.1             100.1.1.1             
VPCS> show ip

NAME        : VPCS[1]
IP/MASK     : 172.16.47.1/24
GATEWAY     : 172.16.47.254
DNS         : 
MAC         : 00:50:79:66:68:15
LPORT       : 20000
RHOST:PORT  : 127.0.0.1:30000
MTU         : 1500

VPCS> ping 100.1.1.1

84 bytes from 100.1.1.1 icmp_seq=1 ttl=63 time=5.912 ms
84 bytes from 100.1.1.1 icmp_seq=2 ttl=63 time=5.076 ms
84 bytes from 100.1.1.1 icmp_seq=3 ttl=63 time=4.458 ms
84 bytes from 100.1.1.1 icmp_seq=4 ttl=63 time=2.594 ms
84 bytes from 100.1.1.1 icmp_seq=5 ttl=63 time=2.632 ms

VPCS> 

你可能感兴趣的:(网络实训,网络)