设备如下
R1 R2 R1-LAN
设备连接如下
R1 G 0/1/0 R2 G 0/1/0
R1 G 0/1/1 R1-LAN G 0/1/1
设备配置如下
R1-LAN
[r1-lan-GigabitEthernet0/1/1]ip add dhcp
ip add dhcp
Routing Tables: Public
Destinations : 2 Routes : 2
Destination/Mask Proto Pre Cost NextHop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
R1-LAN DHCP
[r1-lan-GigabitEthernet0/1/1]ip add dhcp
GigabitEthernet0/1/1 current state: UP
Line protocol current state: UP
Description: GigabitEthernet0/1/1 Interface
The Maximum Transmit Unit is 1500, Hold timer is 10(sec)
Link delay is 0(sec)
Internet Address is 192.168.1.1/24, acquired via DHCP
IP Packet Frame Type: PKTFMT_ETHNT_2, Hardware Address: 000f-fb00-1300
IPv6 Packet Frame Type: PKTFMT_ETHNT_2, Hardware Address: 000f-fb00-1300
Physical is GigabitEthernet0/1/1, baudrate: 1000000000
Output queue : (Urgent queuing : Size/Length/Discards) 0/100/0
Output queue : (Protocol queuing : Size/Length/Discards) 0/500/0
Output queue : (FIFO queuing : Size/Length/Discards) 0/75/0
Last 5 seconds input: 0 bytes/sec 0 packets/sec
Last 5 seconds output: 0 bytes/sec 0 packets/sec
14 packets input, 1504 bytes, 0 drops
60 packets output, 18084 bytes, 0 drops
R1 NAT配置
acl number 2013
rule permit source 192.168.1.0 0.0.0.255
int g 0/1/0
nat outbound 2013
R1-LAN Test
ping 202.103.24.2
PING 202.103.24.2: 56 data bytes, press CTRL_C to break
Reply from 202.103.24.2: bytes=56 Sequence=1 ttl=254 time=4 ms
Request time out
Reply from 202.103.24.2: bytes=56 Sequence=3 ttl=254 time=10 ms
Reply from 202.103.24.2: bytes=56 Sequence=4 ttl=254 time=10 ms
Reply from 202.103.24.2: bytes=56 Sequence=5 ttl=254 time=5 ms
--- 202.103.24.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 4/7/10 ms