一、路由器配置
hostname R1 //配置主机名
no ip domain-lookup //禁止DNS解析
二、交换机
1.基本配置
int vlan 1 //配置虚拟接口
ip add 192.168.1.100 255.255.255.0
no shutdown
ip default-gateway 172.16.1.1 //配置默认网关
2.访问限制
enabled password abc //用户模式进入特权模式的密码,明文
enable secret abc //用户模式进入特权模式的密码,加密
3.配置Telnet远程登录的用户名和密码
username wyq password 123
line vty 0 4 //进入虚拟终端线性模式,0 4 表示5个虚拟终端
password 123 //Telnet远程的密码
login local //用户登录
三、查看
show running-config
show int f0/0 //查看接口信息
show ip int f0/0 //查看接口和ipv4的信息
show ip arp //查看ARP表
show ip route
show users //查看交换机的用户
do show ip int b //查看所有接口配置
四、VLAN、Trunk配置
1.创建vlan,并把端口划分给vlan
vlan 10 //创建vlan10
vlan 20
int f0/0
switchport mode access //端口模式为access
switchport access vlan 10 //把端口划分到vlan10中
int f0/1
switchport mode access
switchport access vlan 20
2.配置trank
int f0/0
switchport mode trunk
switchport trunk allowed vlan 10,20 //只允许vlan10,20的通过
switchport trunk allowed vlan all //允许所有通过
五、OSPF协议
router ospf 1
router-id 1.1.1.1
network 192.168.1.0 0.0.0.255 arer 0
show ip ospf neighbor
ip ospf priority 10 //优先级为10
ip ospf cost 10 //花销为10
clear ip ospf process //参与选举的路由器需要执行
六、RIP协议
router rip
version 2/1
network 192.168.1.0
no auto-summary //关闭自动总结
passive-interface g0/0 //只收不发
show ip protocols
default-information orginate //注入默认路由