计算机网络实验配置命令

计算机网络实验课有很多的配置路由器和交换机的命令,总结一下,以备查阅:

1.配置VLAN
[S1] vlan 2
[S1-vlan-2] port Ethernet 1/0/1
[S1-vlan-2] interface vlan 2
[S1-vlan-interface2] ip address 192.168.2.1 24

VLAN1是默认VLAN,配置的时候直接从第三条命令开始,不需要配置其端口
2.配置OSPF
[R1]router id 1.1.1.1
[R1] ospf
[R1-ospf-1] area 0
[R1-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255

network命令是开启端口对于某一网段的OSPF协议
3.开启路由器tracert功能
[R1] ip ttl-expires enable
[R1] ip unreachables enable

开启这两个才能用tracert,否则会匿名路径和延迟
4.重启路由器或者交换机
[R1] reset saved-configuration 
[R1] reboot

最好在做实验之前打一遍,防止之前配置干扰实验
5.配置静态路由和默认路由
[R1] ip route-static 192.168.0.0 255.255.0.0 192.168.3.1
[R1] ip route-static 0.0.0.0 0.0.0.0 192.168.5.1

第一条命令第一个地址是路由目标网段地址,然后是子网掩码
最后是去这个网络路由所对应的对方端口地址
6.配置NAT
[R1] acl basic 2001
[R1-acl-2001] rule permit source 10.0.0.0 0.0.0.255
[R1-acl-2001] rule deny source any
[R1] nat address-group 1
[R1-address-group-1] address 192.168.5.105 192.168.5.109
[R1] interface Ethernet 0/1
[R1-Ethernet0/1] nat outbound 2001 address-group 1


7.配置PPP协议
[R1] interface Serial 1/0
[R1-Serial1/0] ip address 192.0.0.1 24
[R1-Serial1/0] link-protocol ppp
[R1-Serial1/0] shutdown 
[R1-Serial1/0] undo shutdown 

<R1> debugging ppp (pap) (chap) all
<R1> terminal debugging

PAP验证:
[R1] local-user RTB class network
[R1-luser-network-RTB] service-type ppp
[R1-luser-network-RTB] password simple aaa
[R1]interface serial 1/0
[R1-serial1/0] ppp authentication pap

[R2] interface serial1/0
[R2-serial1/0] ppp pap local-user RTB password simple aaa

CHAP验证:

[R1] local-user RTB class network
[R1-luser-network-RTB] service-type ppp
[R1-luser-network-RTB] password simple aaa
[R1] interface serial 1/0
[R1-serial1/0] ppp authentication-mode chap
[R1-serial1/0] ppp chap user RTA

[R2] local-user RTA class network
[R2-luser-network-RTA] service-type ppp
[R2-luser-network-RTA] password simple aaa
[R2] interface serial1/0
[R2-serial1/0] ppp chap user RTB

发表评论