I have the following config:

ip dhcp pool Vlan10

interface GigabitEthernet0/0

interface GigabitEthernet0/0.10
  encapsulation dot1Q 10
  ip address
  ip nat inside
  description TrunkToSwitch

int FastEthernet0/0
  switchport access vlan 10

DHCP doesn't give IP to the PC connected to int f0/0. I cannot use the switch because from g0/0 because it's on another building. What am I doing wrong?

  • It's there on the router. I have edited the post now. – user36337 Oct 27 '19 at 18:36
  • 1
    You are confusing switch and router interfaces. For the switch interface, you need an SVI. That will create the layer-3 interface for the VLAN. You are putting the layer-3 address on a specific router interface, not the VLAN for the switch module. – Ron Maupin Oct 27 '19 at 18:41
  • Remember that layer-3 bounds layer-2, so layer-2 frames from your external switch cannot cross the layer-3 interface in the router to reach the switch module in the router. The router is not like a layer-3 switch; it is two separate devices (router and switch) in a single box, and the interfaces are either router interfaces, or they are switch interfaces. You can connect two switches together at layer-2, but not through a layer-3 interface. – Ron Maupin Oct 27 '19 at 19:46

Instead of configuring the IP address on the gigabit interface, create a SVI VLAN10 with the IP address on it and make the gigabit interface an access interface in VLAN 10. Now, your fast Ethernet interface isn’t able to reach the gateway IP since it’s configured on another interface.

interface GigabitEthernet0/0
  switchport mode trunk
  switchport trunk allowed vlan 10
  description TrunkToSwitch

interface FastEthernet0/0
  switchport access vlan 10

interface VLAN10
  ip address
  ip nat inside
| improve this answer | |
  • The g0/0 is going to a switch. How would it negotiate a trunk if I remove the subinterface? – user36337 Oct 27 '19 at 18:42
  • You’re mixing up layers. You can still make it a trunk, don’t make it a routed interface. I edited my configuration example to illustrate this. – Teun Vink Oct 27 '19 at 18:45
  • @user36337, if you want to trunk that way, then you use a switch module interface, not a router interface. Do not confuse the router and switch interfaces, otherwise you end up with problems like this. – Ron Maupin Oct 27 '19 at 18:51
  • g0/0 is not a layer 2 interface. I cannot use switchport on it. – user36337 Oct 27 '19 at 18:53
  • 1
    @user36337, that is a router interface. That is what I am trying to explain; do not confuse the router interfaces with the switch interfaces in your device. It has a switch module that is conceptually a switch connected to your router via SVIs as the layer-3 interfaces. If you want the switch module to connect to other switches via layer-2 (a VLAN), then you must use a switch interface, not a router interface. If the internal switch module is separated from the other switches by a layer-3 interface, then it cannot share VLANs with the other switches (its VLAN 10 is a different VLAN 10). – Ron Maupin Oct 27 '19 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.