cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
430
Views
5
Helpful
2
Replies

Can two vlans go through the same router to the Internet?

kkct
Level 1
Level 1

Hi, I'm a newbie and still struggling with vlans. I have a topology shown in the diagram. I want to assign PC0 and PC1 to two different vlans, and I want both PCs to have internet connection. Is it possible? If yes, what should be the gateway ip address?

 

I've only learned about inter-vlan routing using subinterfaces, but this method does not seem to support internet connection.

1 Accepted Solution

Accepted Solutions

luis_cordova
VIP Alumni
VIP Alumni

Hi @kkct ,

 

Try with this:

 

Router2

 

Interface g0/0

no ip address 

exit 

interface g0/0.10

ip address 192.168.10.254 255.255.255.0

ip nat inside 

exit 

interface g0/0.20

ip address 192.168.20.254 255.255.255.0

ip nat inside 

exit 

 

interface g0/1

ip address X.X.X.X X.X.X.X

ip nat outside

exit 

 

ip route 0.0.0.0 0.0.0.0 g0/1

 

access-list 1 permit 192.168.10.0 0.0.0.255

access-list 1 permit 192.168.20.0 0.0.0.255

 

ip nat inside source list 1 interface g0/1 overload 

 

PC0

192.168.10.1

255.255.255.0

192.168.10.254

 

PC1

192.168.20.1

255.255.255.0

192.168.20.254

 

Regards

View solution in original post

2 Replies 2

luis_cordova
VIP Alumni
VIP Alumni

Hi @kkct ,

 

Try with this:

 

Router2

 

Interface g0/0

no ip address 

exit 

interface g0/0.10

ip address 192.168.10.254 255.255.255.0

ip nat inside 

exit 

interface g0/0.20

ip address 192.168.20.254 255.255.255.0

ip nat inside 

exit 

 

interface g0/1

ip address X.X.X.X X.X.X.X

ip nat outside

exit 

 

ip route 0.0.0.0 0.0.0.0 g0/1

 

access-list 1 permit 192.168.10.0 0.0.0.255

access-list 1 permit 192.168.20.0 0.0.0.255

 

ip nat inside source list 1 interface g0/1 overload 

 

PC0

192.168.10.1

255.255.255.0

192.168.10.254

 

PC1

192.168.20.1

255.255.255.0

192.168.20.254

 

Regards

Thank you so much! I don't know that NAT can be used in this way as it is not mentioned in the textbook

Review Cisco Networking products for a $25 gift card