Cisco: Two interfaces on one network

ciscointerfaceNetwork

I'm a newbie to Cisco Equipment and IOS, but got myself a Cisco 2811 and have been playing with it and getting to grips with the basics quite happily. One problem i'm having is trying to get two interfaces to be on the same network. I have read in many places that it can't be done, or it can be done with a bridge group, but as a newbie I still don't get it.

What I want to achieve is to have one network on two interfaces: FastEthernet0/0 and FastEthernet0/1 on network 192.168.0.0 both with the router at 192.168.0.1

From what I can pick out I think this is what I need to do, but i'm not sure how:

  • Create a virtual bridge interface
  • Assign the virtual bridge interface the IP address 192.168.0.1 with subnet mask 255.255.255.0
  • Assign FastEthernet0/0 and FastEthernet0/1 to the virtual bridge interface

Once I've done that, I can then create a DHCP pool pointing to the network 192.168.0.1 255.255.255.0 and then connecting a device to either FastEthernet0/0 or FastEthernet0/1 will cause the DHCP pool to get an address such as 192.168.0.15 (Note I know how to set up a DHCP pool on a single Interface and have that interface give an IP address just fine)

An already working example of what I'm trying to achieve can be seen in most consumer routers, where there are 4 Ethernet ports which all work on the same network, and have the router at the address 192.168.0.1 assigning IP addresses such as 192.168.0.2 to port one, 192.168.0.3 to port two etc.

Best Answer

You'll find that the ethernet sockets you're speaking of are actually a switch, on those smaller routers.

Cisco does the same thing with SOHO-type equipment, eg 867VAE, for the same reason.

[EDIT rewrote from here down]

With a 2811 you can add a switch module in just the same way, such as HWIC-4ESW. Switch ethernet ports are also called Layer 2 ports, and they are associated to a VLAN (by default VLAN 1) and can be set to be trunk ports, access ports and so on. These are expected to be faster for switch-like behaviour.

You can also add more "layer 3" interfaces, such as with HWIC-2FE. These have IP addresses, access lists and so on. These are expected to be faster for routing behaviour.

Somewhat confusingly, both types of interface are written the same way,but if you, for example, put an IP address on an L2 interface you get an error:

gw(config)#int fastEthernet 0
gw(config-if)#ip address 1.2.3.4 255.255.255.0

% IP addresses may not be configured on L2 links.

If you have a need for say, four interfaces with 192.168.0.1/24 through 192.168.3.1/24 on them, with routing and access control lists, NAT, etc, then there are a couple of common approaches.

Use lots of L3 interfaces in the obvious way

interface fastethernet 0/1
 ip address 192.168.0.1 255.255.255.0
interface fastethernet 1/1
 ip address 192.168.1.1 255.255.255.0
 ...

Use switch ports, with lots of VLANs [EDIT: corrected this to a config which is correct, from an 867VAE with 15.2]

interface FastEthernet0
 switchport access vlan 100
 no ip address
interface FastEthernet1
 switchport access vlan 101
 no ip address
...
interface Vlan100
 ip address 192.168.0.1 255.255.255.0
interface Vlan101
 ip address 192.168.1.1 255.255.255.0
...

Quite how you make VLANs varies on different routers. On a 2811 with the built-in interfaces (tested on 15.1) you can use an external switch with VLANS, and use "subinterfaces" which look like this

interface FastEthernet0/0
 no ip address
!
interface FastEthernet0/0.100
 encapsulation dot1Q 100
 ip address 192.168.0.1 255.255.255.0
!
interface FastEthernet0/0.101
 encapsulation dot1Q 101
 ip address 192.168.1.1 255.255.255.0
...

Choosing between these approaches depends on the hardware you've got. There are sometimes performance complexities or subtle restrictions eg max ether HWICs for a chassis. My understanding is that some Cisco L3-capable interfaces can be put into L2 mode, and they enter this by the switchport command; but some require "subinterfaces", see below.

A structure which is extremely common is sometimes called "router on a stick". A router is configured with one L3 towards internet, and one set as a trunk port towards a switch. The switch has many VLANs; the router has many interface vlan lines.

Note also the so-called "Layer 3 Switch", which is a switch with a router in it that can be enabled in configuration. The difference between a router with a switch in it and a switch with a router in it is mostly one of engineering emphasis; for many purposes it's just a question of which has got the interfaces you want, and perhaps the routing protocols and higher level functions.

Related Topic