In this lab we build a static MAC address table on Cisco switches in Cisco Packet Tracer. A MAC address is the hardware address of a network card, written as 12 hex digits such as 0001.42d6.d6ed. A switch keeps a list of which MAC lives on which port, called the MAC address table, so it can send each frame only where it needs to go.
Normally the switch fills that table by itself (dynamic entries). The catch is that dynamic entries disappear when a device stays quiet, and another device can claim the same MAC on a different port. A static entry lets us pin a server’s MAC to one port ourselves. Most tutorials show one switch and two PCs. Here I use three switches, two VLANs, and trunk links, then test three cases: pinning a server, moving that server to another port, and locking out a guest laptop. Everything was done in Cisco Packet Tracer 8.2.1.
Lab Topology and Devices
The lab models a two-floor office. The CORE switch sits in the server room and connects to the LANTAI1 and LANTAI2 switches over trunk links (lantai is Indonesian for floor). A trunk is a switch-to-switch link that carries more than one VLAN at the same time.
There are two VLANs. VLAN 10 STAFF holds the server, the printer, PC1, and the guest laptop. VLAN 20 FINANCE holds PC0 and PC2. I used two VLANs on purpose, because a static MAC entry always belongs to a single VLAN and people forget that.
CORE on top, LANTAI1 on the left, LANTAI2 on the right

Dashed lines are trunk cables and solid lines go to end devices.
Device Switch / Port VLAN IP MAC
Server0 LANTAI1 Fa0/1 10 192.168.10.10 0001.42d6.d6ed
Printer0 LANTAI1 Fa0/2 10 192.168.10.20 0090.0c07.a398
PC0 LANTAI1 Fa0/3 20 192.168.20.11 -
PC1 LANTAI2 Fa0/1 10 192.168.10.12 -
Laptop0 (guest) LANTAI2 Fa0/2 10 192.168.10.50 0090.2b5d.d3c3
PC2 LANTAI2 Fa0/3 20 192.168.20.12 -
Trunks
CORE (Switch0) Gig0/1 <-> LANTAI1 (Switch1) Gig0/1
CORE (Switch0) Gig0/2 <-> LANTAI2 (Switch2) Gig0/1
All IPs use mask 255.255.255.0 with no gateway (there is no router).Your MAC addresses will be different, because Packet Tracer generates a random MAC for every new device. If you open the .pkt file from this article, the MACs match the table.
Crossover cable for the switch-to-switch trunks

The switches are linked with Copper Cross-Over on their GigabitEthernet ports. The server, printer, PCs, and laptop use Copper Straight-Through to FastEthernet ports. A 2960 can adapt to the wrong cable type on its own, but using the right one is a good habit for real hardware.
Setting IP Addresses on the Server, Printer, PCs, and Laptop
Every device sits on a local network with no router, so an IP and subnet mask are enough. The gateway can stay empty.
The server, PCs, and laptop are set from the Desktop tab. The printer is different because it has no Desktop tab, so its IP goes in the Config tab.
Open Server0

Click Server0 at the bottom left.
Server0 IP

Desktop tab, IP Configuration, Static, then type 192.168.10.10. Click the Subnet Mask box and 255.255.255.0 fills in by itself.
Open Printer0

Click Printer0 under the LANTAI1 switch.
Printer0 IP from the Config tab

Open the Config tab and click FastEthernet0 under INTERFACE. Enter IPv4 Address 192.168.10.20 and Subnet Mask 255.255.255.0. The printer’s MAC Address is shown on this page too.
Open PC1

Click PC1 under the LANTAI2 switch.
PC1 IP

Same as the server, enter 192.168.10.12. Repeat for PC0 (192.168.20.11), PC2 (192.168.20.12), and Laptop0 (192.168.10.50).
Creating the VLANs and Trunks on All Three Switches
A static MAC entry needs a VLAN number, so the VLANs must exist on every switch first. I gave them the same names on all three switches to keep the output easy to read.
Every switch-to-switch cable becomes a trunk. Without trunks, VLAN 10 on the first floor and VLAN 10 on the second floor would never meet.
Open the CORE switch

Click Switch0 at the top, then the CLI tab. Answer no if the initial configuration dialog appears.
enable
configure terminal
hostname CORE
vlan 10
name STAFF
vlan 20
name FINANCE
exit
interface range g0/1 - 2
switchport mode trunk
end
write memory
show interfaces trunkTrunks up on Gig0/1 and Gig0/2

show interfaces trunk lists Gig0/1 and Gig0/2 as trunking with 802.1q encapsulation, and VLANs 1, 10, and 20 active on both.
Open the LANTAI1 switch

Click Switch1 on the left, then the CLI tab.
enable
configure terminal
hostname LANTAI1
vlan 10
name STAFF
vlan 20
name FINANCE
exit
interface range fa0/1 - 2
switchport mode access
switchport access vlan 10
interface fa0/3
switchport mode access
switchport access vlan 20
interface fa0/4
switchport mode access
switchport access vlan 10
interface g0/1
switchport mode trunk
end
write memory
show vlan briefFa0/4 goes into VLAN 10 even though nothing is plugged in yet. We use it later when the server moves.
VLANs on LANTAI1

Fa0/1 and Fa0/2 are in VLAN 10 STAFF, and Fa0/3 is in VLAN 20 FINANCE.
Open the LANTAI2 switch

Click Switch2 on the right, then the CLI tab. The commands are the same as LANTAI1, except the hostname is LANTAI2 and there is no Fa0/4 section.
VLANs on LANTAI2

show vlan brief on LANTAI2 matches: Fa0/1 and Fa0/2 in VLAN 10, Fa0/3 in VLAN 20.
Looking at the Dynamic MAC Address Table
Before adding static entries, it helps to see how the switch learns on its own. Every time a frame comes in on a port, the switch writes down the sender’s MAC and that port.
To create some traffic, PC1 on the second floor pings the server on the first floor. The frames travel through LANTAI2, CORE, and then LANTAI1.
PC1 pings the server across two trunks

From PC1’s Command Prompt:
ping 192.168.10.10Four replies, 0% loss. The trunks and VLAN 10 work across both floors.
The table a little later

A short while after the ping I opened LANTAI1 and ran show mac address-table. The server and PC1 were already gone. The only entry left was the CORE switch’s MAC on Gig0/1, type DYNAMIC.
That is how dynamic entries behave. When a device goes quiet, its entry is aged out. On real switches the default is 300 seconds. show mac address-table aging-time is not available in Packet Tracer, so I could not display the timer here.
Finding the Server and Laptop MAC Addresses
The static command needs the full MAC. The safest way to get it is from the device itself, not from a switch table that may already be empty.
Cisco writes MAC addresses as three groups of four hex digits separated by dots, for example 0001.42d6.d6ed. Upper or lower case does not matter.
Server0 MAC in the Config tab

Open Server0, go to the Config tab, and click FastEthernet0. The MAC Address is 0001.42D6.D6ED.
Laptop0 MAC

Same steps on Laptop0 show 0090.2B5D.D3C3. We treat this laptop as a guest device that should not get onto the network.
Static MAC for the Server on Three Switches
The command format is mac address-table static MAC vlan NUMBER interface PORT. In plain words: in this VLAN, this MAC is always on this port.
The entry goes on all three switches, and each one points toward the server from where it stands. LANTAI1 points at Fa0/1 because the server is plugged in there. CORE points at Gig0/1 because the server is somewhere behind LANTAI1. LANTAI2 points at Gig0/1 because every path to the server goes through CORE.
LANTAI1: the server is on Fa0/1

configure terminal
mac address-table static 0001.42d6.d6ed vlan 10 interface fa0/1
end
write memory
show mac address-table staticThe new entry shows up as type STATIC on Fa0/1. It stays there even if the server says nothing for days.
CORE: the server is toward Gig0/1

configure terminal
mac address-table static 0001.42d6.d6ed vlan 10 interface g0/1
end
write memoryLANTAI2: the server is toward trunk Gig0/1

configure terminal
mac address-table static 0001.42d6.d6ed vlan 10 interface g0/1
end
write memoryThis screenshot already includes the guest laptop entry covered in the next section.
PC1 pings the server after the static entries

PC1 pings the server again and still gets 0% loss. A static entry changes nothing while the server stays on the right port.
Locking Out the Guest Laptop with a Static MAC
Real Catalyst IOS has mac address-table static MAC vlan NUMBER drop. Every frame to or from that MAC is thrown away, so the device cannot talk to anyone.
I tried drop in Packet Tracer and it was rejected. So I used a workaround that you can still practise: pin the laptop’s MAC to an empty port.
drop is not supported in Packet Tracer

mac address-table static 0090.2b5d.d3c3 vlan 10 dropPacket Tracer answers % Invalid input detected right at the word drop. The same command works on a real Catalyst switch.
My experience: Workaround for drop: point the laptop’s MAC at a port nobody uses. I picked Fa0/24 on LANTAI2. The switch then sends every reply meant for the laptop out of the empty Fa0/24, so the laptop never hears back from anyone.
configure terminal
mac address-table static 0090.2b5d.d3c3 vlan 10 interface fa0/24
end
write memory
show mac address-table staticLANTAI2 now has two static entries: the server on Gig0/1 and the laptop on Fa0/24.
Open Laptop0

Click Laptop0 under LANTAI2, open Desktop, then Command Prompt.
The guest laptop cannot reach the server

ping 192.168.10.10Four Request timed out, 100% loss. The laptop’s ping does reach the server, but the server’s reply is sent to Fa0/24. Compare that with PC1 on the same switch, which still pings fine.
The Hard Test: Moving the Server to Another Port
This happens in real offices all the time. Someone moves the server cable to a different port without knowing there is a static entry. A normal switch would relearn the MAC within seconds, but a static entry does not move by itself.
To try it, I deleted the Server0 cable from LANTAI1 Fa0/1 and plugged the server into Fa0/4 instead.
The server is now on Fa0/4

Use the Delete tool (the X icon) on the toolbar, click the server cable, then draw a new straight-through cable from Server0 FastEthernet0 to LANTAI1 FastEthernet0/4. Wait until the port triangles turn green.
PC1 can no longer ping the server

ping 192.168.10.10100% loss, even though the server is powered on and cabled. LANTAI1 still believes the server lives on Fa0/1, so every frame for the server goes out of a port that is now empty.
Move the static entry to Fa0/4

configure terminal
no mac address-table static 0001.42d6.d6ed vlan 10 interface fa0/1
mac address-table static 0001.42d6.d6ed vlan 10 interface fa0/4
end
write memory
show mac address-table staticIn Packet Tracer the no command replied Address not found, but the new Fa0/4 entry replaced the old one right away. In the end there is only one static entry for the server, on Fa0/4.
Proof in the running-config

show running-config | include macThere is a single line for the server, now on FastEthernet0/4. Packet Tracer stores it in the older mac-address-table form with a hyphen. Both spellings mean the same thing.
The ping is back

PC1 pings the server again and gets 0% loss. The lesson: whenever you move a device that has a static MAC entry, the entry on the switch has to move too.
When to Use a Static MAC and When Not To
A static MAC suits devices that rarely move but matter a lot, such as servers, network printers, CCTV recorders, or the gateway router. The switch never has to relearn them, and no other device can claim that MAC on another port.
For staff PCs and laptops it is more trouble than it is worth, because people change desks. For those, port security is a better fit since it can learn MACs automatically with sticky.
Need Choice
Server, printer, NVR that never moves Static MAC
Limit the number of devices per port Port security
Block one MAC (real switch) static ... drop
Block one MAC in Packet Tracer static to an empty portCommon Problems and Fixes
Mistakes with static MAC entries usually produce no error message. The switch accepts the command, and then traffic simply stops.
So make a habit of running show mac address-table static after every change and checking each port against the topology.
A device becomes unreachable after its cable is moved
The static entry still points at the old port. Remove the old entry and create a new one on the correct port.
The command fails with Invalid input
The MAC is in the wrong format (colons or hyphens), or you used the drop option in Packet Tracer. Use the 0001.42d6.d6ed format.
The static entry has no effect
The VLAN number does not match the device’s port VLAN. An entry for vlan 20 does nothing for a device in VLAN 10.
Devices on the other floor cannot ping
The entry on CORE or on the other floor switch points at the wrong port. Each switch points toward the device from its own position.
The server MAC is now pinned on three switches, the guest laptop is locked out, and we have seen what happens when a server moves without updating the entry. If you want a refresher on VLANs and trunks, see VLAN trunk between two switches. A three switch topology like this is also a good place to try EtherChannel mode on and PAgP, so the links between switches have a backup. If something breaks while you follow along, leave a comment below.












