网络配置命令

特权模式下面配置:
禁用DNS:
no ip domain-lookup
为执行模式配置口令class:
enable secret class
为控制台连接配置命令:
line console 0
password cisco
login
为vty连接配置口令:
line vty 0 4
password cisco
login

配置ppp封装CHAP:
Router(config-if)#encapsulation ppp(在窗口模式下配置PPP)
Router(config-if)#hostname name(指定自己路由器的主机名)
Router(config-if)#username name password password(确认被认证路由器的用户名和密码)
Router(config-if)#PPP authentication{chap|chap pap|pap chap|pap}(选择PAP还是CHAP作为认证协议)


OSPF协议:
  
       环回接口:Router(config)#interface loopback 0
                      Router(config-if)#ip address 172.16.17.5 255.255.255.255
        如果ospf路由进程已经启动,必须重新清除ospf进程,新的路由器ID才生效
    OSPF Router-id 命令
                  Router(config-router)#router-id ip-address
   Router(config-if)#router ospf 1
   Router(config-router)#router-id 172.16.1.1
显示路由器ID  show ip  ospf


配置路由汇总
   Router(config-router)#area area-id range address mask
   Router (config-router)#summary-address mask [not-advertise][tag tag]

OSPF中默认路由
    Router(config-router)#default-information originate [always]
 
      配置路由器R1提供DHCP服务 :
R1(config)#service dhcp                     //开启DHCP服务
R1(config)#no ip dhcp conflict logging      //关闭DHCP冲突日志
R1(config)#ip dhcp pool ccie                //定义地址池
R1(dhcp-config)#network 192.168.1.0 /24 
 //DHCP服务器要分配的网络和掩码
R1(dhcp-config)#domain-name cisco.com       //域名
R1(dhcp-config)#default-router 192.168.1.1 
 //默认网关,这个地址要和相应网络所连接的路由器的以太口地址相同
R1(dhcp-config)#netbios-name-server 192.168.1.2    //WINS服务器
R1(dhcp-config)#dns-server 192.168.1.4             //DNS服务器
R1(dhcp-config)#option 150 ip 192.168.1.3          //TFTP服务器
R1(dhcp-config)#lease infinite                     //定义租期
R1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.5
 //排除的地址段


配置路由器R1提供NAT服务
R1(config)#ip nat inside source static 192.168.1.1 202.96.1.3
//配置静态NAT映射
R1(config)#ip nat inside source static 192.168.1.2 202.96.1.4
R1(config)#interface g0/0
R1(config-if)#ip nat inside
//配置NAT内部接口
R1(config)#interface s0/0/0
R1(config-if)#ip nat outside
//配置NAT外部接口
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 202.96.1.0
配置路由器R2:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 202.96.1.0
R2(config-router)#network 2.0.0.0

配置路由器R1提供NAT服务
R1(config)#ip nat pool NAT 202.96.1.3 202.96.1.100 netmask 255.255.255.0  
//配置动态NAT转换的地址池
R1(config)#ip nat inside source list 1 pool NAT
//配置动态NAT映射
R1(config)#access-list 1 permit 192.168.1.0 0.0.0.255
//允许动态NAT转换的内部地址范围
R1(config)#interface g0/0
R1(config-if)#ip nat inside
R1(config-if)#interface s0/0/0
R1(config-if)#ip nat outside
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 202.96.1.0
配置路由器R2:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 202.96.1.0
R2(config-router)#network 2.0.0.0

S1#vlan database
//进入到VLAN 配置模式
S1(vlan)#vlan 2 name VLAN2
VLAN 2 added:
Name: VLAN2
//以上创建vlan,2就是vlan的编号,VLAN号的范围为1~1001,VLAN2是该VLAN的名字:

S1(vlan)#vlan 3 name VLAN3
VLAN 3 added:
Name: VLAN3
S1(vlan)#exit
APPLY completed.
Exiting....
//退出VLAN模式,创建的VLAN立即生效

S1(config)#interface f0/1
S1(config-if)#switch mode access
//以上把交换机端口的模式改为access模式,说明该端口是用于连接计算机的,而不是用于trunk

S1(config-if)#switch access vlan 2
//然后把该端口f0/1划分到VLAN 2中
S1(config)#interface f0/2
S1(config-if)#switch mode access
S1(config-if)#switch access vlan 3


S2上创建VLAN,并划分VLAN
S2(config)#vlan 2 
S2(config-vlan)#name VLAN2
S2(config-vlan)#exit
S2(config)#vlan 3 
S2(config-vlan)#name VLAN3

S2(config)#interface f0/1
S2(config-if)#switch mode access
S2(config-if)#switch access vlan 2
S2(config)#interface f0/2
S2(config-if)#switch mode access
S2(config-if)#switch access vlan 3

配置trunk
S1(config)#int f0/13
S1(config-if)#switchport trunk encanpsulation dot1q
//以上是配置trunk链路的封装类型,同一链路的两端封装要相同。有的交换机,例如2950只能封装dot1q,因此无需执行该命令。
S1(config-if)#switch mode trunk
//以上是把接口配置为trunk

S2(config)#int f0/13
S2(config-if)#switchport trunk encanpsulation dot1q
S2(config-if)#switch mode trunk

配置Native VLAN
S1(config)#int f0/13
S1(config-if)#switchport trunk native vlan 2
//以上是在Trunk链路上配置Native VLAN,我们把它改为VLAN 2了,默认是VLAN 1。
S1#show interface f0/13 trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/13      on           802.1q         trunking      2
//可以查看trunk链路的Native VLAN改为2了。

S2(config)#int f0/13
S2(config-if)#switchport trunk native vlan 2


DTP配置
S1(config-if)#switchport mode dynamic desirable
S1(config-if)#switchport trunk encapsulation negotiate

S2(config-if)#switchport mode dynamic auto
S2(config-if)#switchport trunk encapsulation negotiate

在S1和S2两端一一配置DTP为各种模式:negotiate、nonegotiate、desirable、auto,观察链路是否形成Trunk

 

配置S1为VTP server
S1(config)#vtp mode server
Device mode already VTP SERVER.
//以上配置S1为VTP server,实际上这是默认值
S1(config)#vtp domain VTP-TEST
Changing VTP domain name from NULL to VTP-TEST
//以上配置VTP域名
S1(config)#vtp password cisco
Setting device VLAN database password to cisco
//以上配置VTP的密码,目的是为了安全,防止不明身份的交换机加入到域中


配置S3为VTP transparent
S3#vlan database
S3(vlan)#vtp transparent
Setting device to VTP TRANSPARENT mode.
S3(vlan)#vtp domain VTP-TEST
Domain name already set to VTP-TEST .
S3(vlan)#vtp password cisco
Setting device VLAN database password to cisco.
该2950的IOS版本只支持在vlan database下配置vlan。

配置S2为VTP client
S2(config)#vtp mode client
Setting device to VTP CLIENT mode.
S2(config)#vtp domain VTP-TEST
Domain name already set to VTP-TEST.
S2(config)#vtp password cisco

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值