2

I have a router that has 4 VLANs configured, with an interface on each vlan, the router serves as a gateway and provides internet access.

VLAN  |  Interface      |  Function
---------------------------------------
  1   |  192.168.1.1/24  |  DMZ
  2   |  192.168.2.1/24  |  Phones
  3   |  192.168.3.1/24  |  Work Stations
  4   |  192.168.4.1/24  |  Servers

The router has a single cable connecting it to a Cisco 3750 (Gi1/0/1), this connection is setup as an 802.11q trunk.

Other than the trunk port, the other ports on the switch are split among the 4 VLANs.

VLAN  |  Interface
--------------------
1     |  Gi1/0/2-6
2     |  Gi1/0/7-12
3     |  Gi1/0/13-18
4     |  Gi1/0/19-24

How can I set up the switch so that all VLANs have internet access, via there respective gateways on the router. While still allowing any required inter-vlan communication to occur on the switch itself?

The inter-vlan communication I require is as follows:

from   |  to
--------------
2      |  1
3      |  1
4      |  1

I would prefer to run the DHCP server on the Cisco switch, but if necessary I can run it on the router.

13
  • A switch is simply not a router. May 14, 2016 at 6:06
  • @JuliePelletier But it is a layer 3 switch: System image file is "flash:c3750-advipservicesk9-mz.122-35.SE5.bin"
    – James
    May 14, 2016 at 6:10
  • I don't have access to such a switch to check it fully but I think cisco.com/c/en/us/td/docs/switches/lan/catalyst3750/software/… could help you. May 14, 2016 at 6:15
  • It's hard to give you a useful answer without understanding a lot more about your setup. For example, does the router that provides Internet access have routes to all these subnets? Can it NAT for them? And so on. May 14, 2016 at 6:30
  • @DavidSchwartz Yes the router can NAT for the subnet. It could provide full DHCP to the subnet, or I could add static routes as necessary.
    – James
    May 14, 2016 at 6:35

2 Answers 2

1

Let me assume that the interface of the router connected to the Cisco 3750 switch is FastEthernet 0/0, and the interface connected to internet is FastEthernet 0/1

The following router configuration would suffice for connectivity to the internet and inter-vlan communications :

!
interface FastEthernet0/0
 ip address 192.168.1.100 255.255.255.0
 ip nat inside
!
interface FastEthernet0/0.2
 encapsulation dot1Q 2
 ip address 192.168.2.100 255.255.255.0
 ip nat inside
!
interface FastEthernet0/0.3
 encapsulation dot1Q 3
 ip address 192.168.3.100 255.255.255.0
 ip nat inside
!
interface FastEthernet0/0.4
 encapsulation dot1Q 4
 ip address 192.168.4.100 255.255.255.0
 ip nat inside
!
interface FastEthernet0/1
 ip address 170.150.160.100 255.255.0.0
 ip nat outside
!
!
ip nat inside source list 10 interface FastEthernet0/1 overload
ip classless
!
!
access-list 10 permit 192.168.0.0 0.0.255.255
!
!

The DHCP on the switch must be as given bellow (its made to match the above router configuration) :

!
ip dhcp pool p1
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.100
ip dhcp pool p2
 network 192.168.2.0 255.255.255.0
 default-router 192.168.2.100
ip dhcp pool p3
 network 192.168.3.0 255.255.255.0
 default-router 192.168.3.100
ip dhcp pool p4
 network 192.168.4.0 255.255.255.0
 default-router 192.168.4.100
!
!
interface Vlan1
 ip address 192.168.1.1 255.255.255.0
!
interface Vlan2
 ip address 192.168.2.1 255.255.255.0
!
interface Vlan3
 ip address 192.168.3.1 255.255.255.0
!
interface Vlan4
 ip address 192.168.4.1 255.255.255.0
!
!

NOTE : I have removed commands irrelevant to our context.

You can copy-paste the above configuration at the Global Configuration Mode of the respective devices if you wish

1

First let me say that the new design you have proposed is the best practice and the one you should have implemented from the beginning: a L3 switch such as a 3750 is perfectly capable of performing the inter-VLAN routing, with great performance too.

For this implementation you will have to create a fifth network, one to connect the switch with the router (let's say 192.168.5.1/24 for router LAN port and 192.168.5.2/24 for the switch Gi1/0/1 port).

In general you will have to make these changes:

On the switch

  1. Create 4 interface vlans with the ip addresses 192.168.1.1 through 192.168.4.1 for each vlan respectively.
  2. Delete the configuration of the port Gi1/0/1 and add this:

    no switchport 
    ip address 192.168.5.2 255.255.255.0
    
  3. Add the default route (gateway) like this:

    ip route 0.0.0.0 0.0.0.0 192.168.5.1 
    
  4. Assuming that the router was acting like a DHCP server, now you will have to configure the switch as a DHCP server instead.

On the router

  1. LAN interface: delete all router subinterfaces and 802.11q trunking and assign the ip address 192.168.5.1/24.

  2. Add 4 static routes for networks 192.168.1.0/24 through 192.168.4.0/24 like this:

    ip route 192.168.1.0 255.255.255.0 192.168.5.2 
    ip route 192.168.2.0 255.255.255.0 192.168.5.2 
    ip route 192.168.3.0 255.255.255.0 192.168.5.2 
    ip route 192.168.4.0 255.255.255.0 192.168.5.2
    
  3. Depending the router (you didn't say if it is Cisco one or a basic home router) and your willingness to maintain a clean configuration you may want to disable the DHCP server. Also pay attention how NAT is implemented and whether you have to reimplement it.

That's all! Now enjoy higher performance inter-VLAN routing. Also, the router-switch link will only be used for the internet traffic form now on.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .