Problem
You want to force a particular Ethernet speed or duplex setting.
Solution
Cisco routers allow you to adjust several different Layer 1 and 2 parameters on Ethernet interfaces, depending on the specific hardware. On interfaces that support more than one medium, you can specify which media type you want to use with the media-type command:
Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#interface FastEthernet0/0 Router1(config-if)#media-type 100BaseX Router1(config-if)#duplex full Router1(config-if)#speed 100 Router1(config-if)#exit Router1(config)#end Router1#
You can also adjust parameters such as the ARP timeout interval, the MAC address, and the keepalive timer on the interface:
Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#interface FastEthernet0/0 Router1(config-if)#mac-address 0AAA.ABCD.0101 Router1(config-if)#arp timeout 60 Router1(config-if)#keepalive 5 Router1(config-if)#exit Router1(config)#end Router1#
Discussion
Most of the time, you will just want to use the default options when setting up Ethernet interfaces. By default, most Ethernet modules will automatically sense which media type is in use, as well as the duplex and speed settings. In this example, we have explicitly forced the router to use its 100BaseX medium, full duplex, and 100Mbps speed settings:
Router1(config)#interface FastEthernet0/0 Router1(config-if)#media-type 100BaseX Router1(config-if)#duplex full Router1(config-if)#speed 100
The options for the media-type command depend on the module. Fast Ethernet modules often include a Media Independent Interface (MII), for example. By default, the router will usually select the appropriate one by sensing the Ethernet carrier signal when you connect it to another device. But sometimes there are problems with this auto sense, and you want to force the router to use a particular one. Alternatively, you may want to ensure that nobody can come along and confuse the router by plugging the other unused media interface into another device.
By default, the router will also attempt to detect both duplex and speed on Fast Ethernet modules. Naturally, these options are not available on most conventional 10 Mbps Ethernet modules, although Cisco does make full-duplex capable 10 Mbps modules for some router models. The options for the duplex command are full, half, and auto. Interestingly, you can also set the duplex options with these alternative commands:
Router1(config-if)#full-duplex Router1(config-if)#half-duplex
There are often problems with auto negotiation. When the duplex auto negotiation process fails to work properly, the interface will still work, but you will see poor performance with a large number of errors. Because the router is generally the most important device on a LAN segment, we strongly recommend deliberately setting both the speed and duplex on routers to ensure that there is no possibility for confusion between the router and the LAN switch or hub.
The parameters that we modified in the second example in this recipe rarely need to be changed in practice:
Router1(config)#interface FastEthernet0/0 Router1(config-if)#mac-address 0AAA.ABCD.0101 Router1(config-if)#arp timeout 60 Router1(config-if)#keepalive 5
The default MAC address is the burned-in address (BIA) that we discussed in Recipe 16.1. There are a few reasons why you might want to change the MAC address. For example, sometimes a piece of legacy equipment expects to see a particular MAC address, or there might be an access-list that filters traffic based on this address. In this case, it can be awkward to deal with hardware problems that force you to replace or upgrade either a router or a module. So you can use the mac-address command to give this router the same address as the previous router had.
Always be careful when changing MAC addresses. If two devices on the same network wind up with the same MAC address, it can disrupt traffic for both devices as the switches try to figure out which one is which. And, if one of these devices is a router, it can disrupt all off-segment traffic. MAC addresses must be unique.
The router uses its ARP cache table to map IP addresses to MAC addresses for devices on the local LAN segment. By default, if the router has not seen any traffic from a particular MAC address within 14,400 seconds (four hours), it will flush the entry out of its ARP cache.
Sometimes this is not appropriate, however. For example, in many bridged environments, the bridges will remove MAC table entries after a shorter period such as 10 minutes. In this case, if a station has been idle for more than 10 minutes but less than 4 hours, the router will send the packet normally, but the bridge will have to flood all segments with the traffic to find the destination device. It may be more efficient if the router simply sends out a fresh ARP query for the destination. So you will probably want to reduce your ARP timeout if this is the case.
You may also want to change the ARP timeout in environments where the MAC address associated with a particular IP address changes frequently. This could happen because of DHCP, for example. Or, you will get a similar effect if there are so many ARP entries that the ARP cache frequently fills up and the router has to drop entries. In these cases, you might want to reduce the ARP timeout period using the arp timeout command:
Router1(config-if)#arp timeout 60
The argument to this command is a time in seconds.
Finally, the keepalive command allows you to control how often the router sends out a keepalive packet on the interface. This allows the router to test whether the interface is still active. By default, the router will send a keepalive packet every 10 seconds, and consider the interface to be down if it fails to see three packets in a row. If you need the router to respond more quickly to failures, you can reduce this interval by using the keepalive command:
Router1(config-if)#keepalive 5
This command takes a single argument, which is the time interval in seconds. Giving this command an argument of 0 is the same as disabling keepalives on the interface. If you do this, the router will simply stop sending keepalive packets, and will always think that the interface is available no matter what happens.
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index