路由器的路由配置命令汇总(win和linux系统)
分类: 系统运维
route [-f] [-p] [Command][Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]
-f 清除所有网关入口的路由表。如果该参数与某个命令组合使用,路由表将在运行命令前清除。
-p 与 add 命令一起使用时使路由具有永久性。 该参数与 add 命令一起使用时,将使路由在系统引导程序之间持久存在。默认情况下,系统重新启动时不保留路由。与 print 命令一起使用时,显示已注册的持久路由列表。
忽略其他所有总是影响相应持久路由的命令。
Command 指定您想运行的命令 (Add/Change/Delete/Print)。
1.主机路由从一台主机映射一条到本地网络上的的其他主机上
command format:
route add -host destination_ip local_ip -interface interface
eg:
我们想为本地主机接口hme0(204.12.17.1)和另一台在相邻才C类网络上的主机(204.12.16.100)之间增加一条路由
#route add -host 204.12.16.100 204.12.17.1 -interface hme0
增加一个到另一个网络的的直接路由
command format:
route add -net destination_network_ip local_ip -netmask mask
eg:
如果我们要想为C类网掩码在本地主机(204.12.17.1)和我们上面指出的网络之间增加一条路由(204.12.16.0网络)我们可以使用如下的命令:
#route add -net 204.12.16.0 204.12.17.1 -netmask 255.255.255.0
command format:
route add default hostname -interface interface
eg:增加一条到本地路由器(204.54.56.1)的缺省路由,通常用在添加网关并马上生效
#route add default 204.54.56.1 -interface hme1
/? 在命令提示符处显示帮助。
destination 或 gateway 使用的符号名称。如果命令是 print 或 delete,目标和网关
还可以使用通配符,也可以省略网关参数。
示例
若要显示 IP 路由表的全部内容,请键入:
route print
route print 10.*
route add 0.0.0.0 mask 0.0.0.0 192.168.12.1
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3
route delete 10.41.0.0 mask 255.255.0.0
route delete 10.*
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25
1.ifconfig 查看网络接口的信息。普通用户使用ifconfig的全路径:/sbin/ifconfig
ifconfig eth0 hw ether 1234567890ab
ifconfig eht0 up
router>enable
router#
router#config terminal
router(config)#
router(config)#hostname A
A(config)#
A(config)#interface fastethernet 0/0
A(config-if)#
router#show interface serial 0/0
serial 0/0 is up ,line protocol is up
可操作状态………serial 0/0 is up ,line protocol is up
连接问题…………serial 0/0 is up ,line protocol is down
接口问题…………serial 0/0 is down ,line protocol is down
禁用状态…………serial 0/0 is administratively down ,line protocol is down
|
192.168.1.1
|
|
192.168.2.2
|
|
192.168.2.1
|
|
192.168.3.1
|
|
192.168.1.10
|
|
192.168.3.10
|
静态路由的实现
router(config)#hostname A
A(config)#interface f0/0
A(config-if)#ip address ip地址 子网掩码
A(config-if)#no shutdown
B(config)#interface f0/1
B(config-if)#ip address ip地址 子网掩码
B(config-if)#no shutdown
A(config)#ip route 目标网络地址 子网掩码 下一跳地址
B(config)#ip route 目标网络地址 子网掩码 下一跳地址
route(config)#ip route 0.0.0.0 0.0.0.0 下一跳地址
router#show ip route
其中C代表直连的网络,S代表静态的路由,S*代表默认的路由
router (config-line)#login
router (config-line)#password cisco
router (config)#enable password cisco
router (config)#enable secret 1234
router (config)#service password-encryption
router(config)#line console 0
router(config-line)#exec-timeout 0 0 //第一个0代表分钟,第二个0代表秒 此处0 0为永不超时
router(config)#line console 0
router(config-line)#logging synchronous
router(config)#no ip domain-lookup
重启路由器按Ctrl+Break键进入ROM Monitor 模式
rommon 1>confreg 0x2142
rommon 2>reset
重启后选择no
router>enable
router#copy startup-config running-config
router#config terminal
router(config)#enable password cisco
router(config)#config-register 0x2102
router#copy running-config startup-config
router#reloa
路由器的路由配置命令汇总(win和linux系统)的更多相关文章
- CCNA网络工程师学习进程(7)路由器的路由配置
前面一节已经介绍了路由器的端口配置,接着我们介绍路由器的路由配置:静态路由.默认路由和浮动路由的配置:动态路由协议的配置,包括RIP.IGRP.EIGRP和OSPF. (1)路由器的基 ...
- redhat 安装配置samba实现win共享linux主机目录
[转]http://blog.chinaunix.net/uid-26642180-id-3135941.html redhat 安装配置samba实现win共享linux主机目录 2012-03-1 ...
- centos7/rhel7下配置PXE+Kickstart自动安装linux系统
应用场景:临时安装一个系统或者批量安装linux系统,无需人工介入选择下一步,减少在安装系统上的时间浪费,提高工作效率. DHCP + TFTP + Syslinux + FTP + Kickstar ...
- 获取Win和Linux系统启动时间,类似uptime功能,用于判断是否修改过系统时间
目录 前言 测试代码 Win测试 Linux测试 总结 前言 有时候需要判断系统是否有修改过时间,最简单的方法就是获取当前时间A,然后sleep X秒,然后获取 时间B,如果 时间B - 时间A ≠ ...
- 使用SCP命令在多个linux系统间进行copy拷贝,上传,下载...
一,什么是scp scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令.scp命令可以在linux服务器之间复制文件和目录.scp使用ssh安全协议传输数据,具有和ssh一样的验证机制,从 ...
- 使用scp命令在多个Linux系统间进行文件复制
一,什么是scp scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令.scp命令可以在linux服务器之间复制文件和目录.scp使用ssh安全协议传输数据,具有和ssh一样的验证机制,从 ...
- 华为路由器RIP路由协议配置命令
RIP路由协议配置 rip 创建开启协议进程 network + ip 对指定网段接口使能RIP功能IP地址是与路由器直连的网段 debugging rip 1 查看RIP定期更新情况 termina ...
- cisco交换机路由器静态路由配置
一.切换模式 router>en //用户模式enable router#conf t //特权模式 ...
- 华为路由器NAT基本配置命令
NAT地址转换 静态 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]nat static global 202.169.10.5 inside 172.16.1.1 ...
随机推荐
- sql查询并把数据更新到另一个表中
update OpenBills set peopleCount=(select rtNumber from Rooms where obId='ZD201005223') where obId='Z ...
- 2019年6月SAP发布的未来ABAP平台的发展方向
未来ABAP平台将始终是这些产品的技术平台: S/4HANA On-Premises和Cloud将基于一个统一的ABAP codeline: SAP云平台上的ABAP编程环境: 什么是SAP Clou ...
- 雨后清风U盘启动盘的五大用处及制作方法
如果有一个U盘可以帮助你安装系统,或者在你的电脑系统崩溃时帮助你修复系统,是不是很方便呢?雨后清风U盘启动盘就能帮你实现这样的效果.除此之外,雨后清风U盘启动盘还有另外一些用处.下面就来和大家分享一下 ...
- less-important
!important关键字:会为所有混合带来的样式,添加!important 在css里面加上!important,是所有样式优先级最高的 在less里面什么场景会用important,在调试的时候 ...
- 什么是 java 序列化?(未完成)什么情况下需要序列化?(未完成)
什么是 java 序列化?(未完成)什么情况下需要序列化?(未完成)
- synchronized 和 ReentrantLock 区别是什么?(未完成)
synchronized 和 ReentrantLock 区别是什么?(未完成)
- 从头至尾一点点实现自己的ViewPager效果
对于ViewPager,应该没有人在项目中没使用过它,效果非常的赞,使用也非常简单,但是如果自己来实现这样的效果,我想并非三下五除二的事了,这里涉及到怎么自定义ViewGroup了,它相比自定义Vie ...
- 【万能的DFS和BFS基础框架】-多刷题才是硬道理!
- python cmd 窗口 中文乱码 解决方法 (附:打印不同颜色)
python cmd 窗口 中文乱码 解决方法 (附:打印不同颜色) 前言 在 python 开发中,有时候想通过cmd窗口来和用户交互,比如显示信息之类的,会比自己创建 GUI 来的方便,但是随之而 ...
- spring replaced method 注入
replaced method注入是spring动态改变bean里方法的实现.需要改变的方法,使用spring内原有其他类(需要继承接口org.springframework.beans ...