Cisco路由器配置入门知识(基础)

09-04

Cisco路由配置基础
刚刚接触cisco路由配置,下面是学习的笔记,感觉命令还是多敲才能熟悉

一、 所处状态各类

router>
用户处于用户命令状态,可以查看网络和主机
router#
用户处于特权模式,可以查看状态,还可以看到和更改路由器的设置内容
router(config)#
全局配置状态,可以设置路由的全局参数
router(config-if)#;router(config-line)#;router(config-router)#.....
处于局部配置状态,可以设置路由的局部参数

二、配置端口ip

命令
en
config t //全局模式
interface f0/0
ip address 192.168.1.1 255.255.255.0 //设置端口ip
no shu //生效
exit
interface f0/1
ip address 192.168.10.1 255.255.255.0
no shu
exit
end
disable

三、配置静态路由

命令
en
config t //全局模式
ip route 192.168.100.0 255.255.255.0 192.168.10.2 //到192.168.100.0/24通过192.168.10.2接口
end
show ip route //可以看到前面标明S,即为静态路由

四、配置动态路由(RIP)

命令
en
config t //全局模式
no route rip //禁止rip协议
route rip
network 192.168.1.0 //network参数为路由的两个端口对应的网络地址
network 192.168.10.0
exit
end
disable

五、配置DHCP

命令
en
config t //全局模式
ip dhcp excluded-address 192.168.1.1 //需要排除的ip地址
ip dhcp pool gr-dhcp-pool //ip地址池名
default-server 192.168.1.1 //指定dhcp服务器
network 192.168.1.0 255.255.255.0 //配置网络
dns-server 61.177.7.1 //配置dns服务器
exit
end
disable
可以通过 ip helper-address指定 DHCP中继代理
interface FastEthernet0/1
ip address 192.168.1.1 255.255.255.0
ip helper-address 192.168.10.2 //配置DHCP中继代理,DHCP

六、配置NAT

命令
en
config t //全局模式
interface f0/0
ip address 192.168.1.1 255.255.255.0
ip nat inside //内部端口
no shu
exit
interface f0/1
ip address 192.168.10.1 255.255.255.0
ip nat outside //外部端口
no shu
exit
access-list 1 permit any //设置一个可访问列表
ip nat pool gr-nat-pool 192.168.10.3 192.168.10.254 netmask 255.255.255.0 //设置分配池
ip nat inside resource list 1 pool gr-nat-pool overload
show ip nat traslations
clear ip nat traslation *

七、其它

sh running-config //显示当前运行配置
sh startup-config //显示开机配置
sh ip route //显示路由
sh nat traslations //显示nat当前情况