Cisco – Cannot put an IP address on layer two interface

ciscocisco-ios

I am trying to assign an IP address to Interface g0/0 on a Cisco 892FSP. However, it keeps telling me that a layer two interface cannot be assigned an IP address. Any ideas?

Best Answer

Please provide your sanitized configuration. Probably you're trying to assign IP address on Layer-2 interface (which is part of switch-module) and that is not allowed. If you want to allow some traffic from switchport to be routed, you need to create VLAN (or use default VLAN 1) and assign IP address on VLAN interface.

Example:

Create VLAN

(config)# vlan 100

Assign VLAN to interface

(config)# interface g0/0
(config-if)# switchport access vlan 100

Create L3 interface and assign IP address to it

(config)# interface Vlan100
(config-if)# ip address 10.10.10.1 255.255.255.0