以R2为实例
静态路由:ip route 目的网段 目的掩码 下一跳地址
ip route 172.16.2.0 255.255.255.0 172.16.3.1
ip route 192.168.1.0 255.255.255.0 192.158.10.6
rip路由:network 接口网段
route rip
version 2
no auto-summary
network 172.16.3.0
network 192.168.10.4
ospf路由:network 接口网段 反掩码 area 区域号
route ospf 1
network 172.16.3.0 0.0.0.3 area 0
network 192.168.10.4 0.0.0.3 area 0
以R0为例
默认路由:ip route 0.0.0.0 0.0.0.0 下一跳地址
ip route 0.0.0.0 0.0.0.0 10.0.0.1
以SWA为例
查看端口配置信息:show running-config
查看指定端口配置信息:show running-config interfaces 端口号
查看端口状态:show interfaces
配置VLAN,加入端口:
VLAN 10 //创建VLAN
VLAN 20
exit
int f0/1
switch mode access //端口模式改为access模式
switch access vlan 10 //将f0/1端口加入VLAN10
exit
int f0/2
switch mode access
switch access vlan 20
配置VLAN接口,开启SWA的 路由功能:
int VLAN 10
ip add 192.168.10.1 255.255.255.0
no shut
int vlan 20
ip add 192.168.20.1 255.255.255.0
exit
ip routing //开启路由功能
SWA配置trunk:
int g0/1
switch trunk encapsulation dot1q //二层端口封装802.1q协议(dot1q),也就是trunk链路的中继协议。
switch mode