Cisco路由器菜鸟更改ip地址备忘
授权方式:署名,非商业用途,保持一致,转载时请务必以超链接(http://www.fwolf.com/blog/post/297)的形式标明文章原始出处和作者信息及本声明。近期网通在大规模调整ip地址,从原来的218地址调整到121地址,原因据说是优化服务,不知真正的居心何在。我这里使用的是cisco 2621的路由器,原先已经由别人配置好了,我虽然是个路由器菜鸟,但是更改一下ip地址还是可以的,顺便把要用到的几个命令记录在这里。
通过控制端口连接上路由器之后,默认的是
提示符,这个状态下只能查看,不能进行配置,输入命令“en“就进入管理模式了,提示符也会有相应改变:
Router#
然后就可以配置了,首先是配置ip地址,就像这样:
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 121.38.148.58 255.255.255.252
Router(config-if)#exit
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip address 121.38.148.49 255.255.255.248
Router(config-if)#exit
Router(config)#no ip route 0.0.0.0 0.0.0.0
Router(config)#ip route 0.0.0.0 0.0.0.0 121.38.148.57
Router(config)#exit
Router#sh run
Building configuration…
……
解释一下:
首先“conf t“到底是什么我也不太清楚,或许t是配置的名称,或许是某个命令的简写,反正这么配就是了:);
然后用interface命令指定要配置的网卡,选定之后ip address命令就是设定网卡地址,如果设置2个地址的话,掩码后面要跟上个secondary;
ip地址设定完之后用exit退出网卡设置的“子过程”,继续配置静态路由,先用“no ip route“清除以前的路由表,然后再用”ip route“设置新的;
最后exit退出设置,“sh run“这个命令也许是运行配置,也许是检查配置,反正执行一下就是了,你会看到所有的配置情况,检查其中的ip地址设置、nat设置、访问权限设置、路由设置等等。
没有什么问题的话应该就可以生效了,但测试成功之后别忘记把配置保存起来,不然路由器一重启配置就恢复成原来的了:
有的时候配置完不生效,需要重启一下光电转换器,或者切换一下光电转换器的模式然后再换回来,只要配置好了能够正常ping上端路由器的互联地址,应该就是没有问题的。不过我配置的时候总是怪怪的,明明配置好了,路由转发就是不成功,后来实在没办法打到网通光纤机房请教,居然是个女孩子在值夜班,服务态度当然是A+了,她那边检查一下居然什么问题都没有了,残念。。。
![[Bloglines]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/bloglines.png)
![[co.mments]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/comments.png)
![[del.icio.us]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/diigo.png)
![[Facebook]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/reddit.png)
![[Rojo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/rojo.png)
![[Slashdot]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/technorati.png)
![[Windows Live]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/email.png)
March 11th, 2007 at 13:51:15
en是enable的缩写 enable相当于linux的root
conf t是 configure terminal 的缩写 意思是进入全局配置模式
sh run 是show running的缩写 作用是显示当前路由器或交换机的配置情况 不起什么作用
interface fastEthernet 0/0 可以缩写成 int fa0/0 进入模块0的第0口配置
March 11th, 2007 at 19:40:54
谢谢linchanx!
en和conf我知道是简写,其他的还真没研究过
毕竟环境不允许太多实践,呵呵