Getting Internet in GNS3 using a Cisco Router
Nerd Cafe
Topology
Your topology consists of:
R1 (Router)
f0/0
(Connected to NAT1) - Acts as a DHCP client (gets IP from NAT)f1/0
(Connected to PC1) - 192.168.0.1/24
PC1
e0
(Connected to R1'sf1/0
) - 192.168.0.100/24
NAT1 (Internet Simulation)
Step 1: Configure the NAT Interface (f0/0
)
f0/0
)Enter the router's configuration mode:
R1#configure terminal
Configure
f0/0
to get an IP via DHCP:
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address dhcp
R1(config-if)#no shutdown
R1(config-if)#
Step 2: Configure LAN Interface (f1/0
)
f1/0
)Assign an IP to
f1/0
and enable it:
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip address 192.168.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
Step 3: Configure NAT for Internet Access
Enable NAT on
f0/0
(outside) andf1/0
(inside):
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip nat outside
R1(config-if)#exit
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip nat inside
R1(config-if)#exit
Create an ACL to allow local network traffic:
R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255
Configure NAT overload:
R1(config)#ip nat inside source list 1 interface FastEthernet0/0 overload
Verify NAT:
R1#show ip nat translations
Step 4: Configure and Test PC1
Assign an IP and default gateway to PC1:
PC1> ip 192.168.0.100/24 192.168.0.1
Checking for duplicate address...
PC1 : 192.168.0.100 255.255.255.0 gateway 192.168.0.1
PC1> show ip
NAME : PC1[1]
IP/MASK : 192.168.0.100/24
GATEWAY : 192.168.0.1
DNS :
MAC : 00:50:79:66:68:00
LPORT : 20008
RHOST:PORT : 127.0.0.1:20009
MTU : 1500
PC1> save
Saving startup configuration to startup.vpc
. done
PC1>
Test connectivity to R1:
PC1> ping 192.168.0.1
84 bytes from 192.168.0.1 icmp_seq=1 ttl=255 time=70.532 ms
84 bytes from 192.168.0.1 icmp_seq=2 ttl=255 time=16.052 ms
^C
PC1>
Test internet connectivity:
PC1> ping 8.8.8.8
84 bytes from 8.8.8.8 icmp_seq=1 ttl=126 time=99.708 ms
84 bytes from 8.8.8.8 icmp_seq=2 ttl=126 time=81.077 ms
^C
PC1>
Step 5: Configure and Verify Routing
Ensure R1 has a default route to the internet:
R1(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0
Step 6: Test and Troubleshoot
Check if NAT is translating:
R1#show ip nat statistics
Total active translations: 0 (0 static, 0 dynamic; 0 extended)
Peak translations: 2, occurred 00:02:59 ago
Outside interfaces:
FastEthernet0/0
Inside interfaces:
FastEthernet1/0
Hits: 4 Misses: 0
CEF Translated packets: 4, CEF Punted packets: 0
Expired translations: 2
Dynamic mappings:
-- Inside Source
[Id: 1] access-list 1 interface FastEthernet0/0 refcount 0
Total doors: 0
Appl doors: 0
Normal doors: 0
Queued Packets: 0
R1#
Keywords
GNS3
, Cisco Router
, Internet Access
, NAT Configuration
, DHCP Client
, FastEthernet
, IP Address
, Default Gateway
, Routing
, ACL
, NAT Overload
, Ping Test
, Network Topology
, Packet Forwarding
, Troubleshooting
, Static Route
, Dynamic IP
, PC Connectivity
, NAT Translations
, Show Commands
, سیسکو
Last updated