配置三层路由:
sw1:
conf t
ip routing //开启三层路由功能
int vlan 2 //为 vlan2 配置网关
ip add 20.1.1.254 255.255.255.0
no sh
exit
int vlan 3 //为 vlan3 配置网关
ip add 30.1.1.254 255.255.255.0
no sh
exit
***********************************************
二层接口是无法配置 IP 地址!!!!
将二层接口配置成三层接口:
int f0/0
no switchport
ip add 30.1.1.1 255.255.255.0
no sh
***********************************************
将一台路由器模拟成 PC:
Conf t
No ip routing //关闭路由功能
int f0/0
ip add 20.1.1.2 255.255.255.0
no sh
exit
ip default-gataway 20.1.1.254
int f0/0
no ip add //删除 ip
ip add dhcp //将该接口设置为自动获取 IP