Ⅰ 路由器怎麼寫命令行
一·CISCO路由器簡介
1.1 CISCO IOS操作環境。
有三種:
ROM monitor > Failure of password recovery
BootROM router(boot) > Flash image upgrade
Cisco IOS router > Normal operation
1.2 Command Modes命令模式。
User EXEC Router> 普通級別
Privileged EXEC Router# 系統管理級別(超級用戶)
Configuration mode Router(config)# 修改配置
二、 配置前的准備工作
2.1 用終端或模擬終端接入CONSOLE口 。
終端或模擬終端配置信息如下:
9600 baud 8 data bits no parity 2 stop bits (9600,8/N/2)
2.2 用TELNET命令在網上進行設置。
系統管理員可在網上用telnet address命令進行遠程配置。
三、 配置IP地址
3.1 config命令行方式進行設置
3.1.1 首先啟動ROUTER 進入router > 模式。
鍵入Enable 進入router # 模式
然後鍵入config 進入router(config)# 模式
3.1.2 選擇要配置的路由器埠
Router(config) # interface埠號
進入埠設置狀態 Router(config-if)
此時用命令IP address <掩碼>
設定路由器埠IP地址
四、 配置ip路由協議 (RIP ,OSPF ,BGP ,STATICS)
在圖中有路由器A和B,廣域網通過router A
的s0/0/0和router B的s2/0/0相連,IP如下:
router A:
E1:202.101.1.1/24
S0/0/0:202.101.3.1/30
router B:
E1:202.101.2.1/24
S2/0/0:202.101.3.2/30
當我們設置路由器協議時,可根據方案的規定設置一種或多種協議。
以下動態協議都是按最簡單設置,復雜的配置可參考具體手冊。
4.1靜態路由
IP route 目的網路地址 子網掩碼 埠號
在router A上配router B的路由:
IP route 202.101.2.0 255.255.255.0 202.101.3.2
在router A上配router B的路由:
IP route 202.101.1.0 255.255.255.0 202.101.3.1
4.2 RIP2設置
router A進行如下設置:
router rip ;enable rip
version 2 ;選擇版本2
network 202.101.1.0 ;相關子網地址
network 202.101.3.0
router B進行如下設置:
router rip ;enable rip
version 2 ;選擇版本2
network 202.101.2.0 ;相關子網地址
network 202.101.3.0
4.3 OSPF設置
router A:
router ospf 200 ;enable ospf 進程號為200
network 202.101.1.0 0.0.0.255 area 0 ; 相關子網地址及區域號
network 202.101.3.0 0.0.0.3 area 0
router B:
router ospf 200 ;enable ospf 進程號為200
network 202.101.2.0 0.0.0.255 area 0 ; 相關子網地址及區域號
network 202.101.3.0 0.0.0.3 area 0
4.4 BGP設置
router A:
router bgp 100 ;enable bgp 設置自治域號
network 202.101.3.0 mask 255.255.255.252 ;相關子網地址及子網掩碼
network 202.101.1.0 mask 255.255.255.0 ; 這些地址由bgp發到鄰居路由器
neighbor 202.101.3.2 remote-as 200 ;設置遠程相連自治域邊界路由器埠
router B:
router bgp 100 ;enable bgp 設置自治域號
network 202.101.2.0 mask 255.255.255.252 ;相關子網地址及子網掩碼
network 202.101.1.0 mask 255.255.255.0 ; 這些地址由bgp發到鄰居路由器
neighbor 202.101.3.1 remote-as 200 ;設置遠程相連自治域邊界路由器埠
五、 radius認證的設置
5.1 radius的簡述
RADIUS的全稱為(Remote Access Dail-In User Service),它是對遠程撥號用戶訪問進行認證的一種協議。主要進行Authentication Authorization Accounting (AAA) 三方面的工作。
5.2 radius的配置
具體配置如下:
aaa new-mode ;enable radius
radius-server host ;指明radius server在網上的地址
radius-server key ;建立一個網上傳輸密
aaa authentication login default radius local ;進行login認證,若radius server未找到從本地資料庫內查找
aaa authentication ppp default radius local
aaa authorization network radius local ;授權檢測
aaa accounting network start-stop radius ;計帳檢測
六、 路由器軟體升級方法
6.1 改變操作環境
在global config mode設置: config -reg 0x2101
reload 進入Boot Rom 模式:router(boot)>
6.2 運行tftp server
在網上運行tftp server,使升級文件可以傳輸。
6.3 升級版本
命令如下:
tftp flash ;將tftp server上的文件傳入路由器的flash memoy中
flash tftp ; 將flash中的文件備份到tftp server中
七、 路由器配置的其它事項
7.1撥號用戶的配置。
cisco 2509/2511的非同步串列通訊口在配置modem時,modem需設置成自動應答方式。具體方法如下:
用超級終端進入modem AT 命令方式,鍵入ats0=1 設置自動應答方式,然後鍵入at&w 將設置寫入寄存器。
7.2 RIP & BGP的設置
當一個運行RIP路由協議的子網,做為一個自治域,用BGP協議接入另一自治域時。此子網內所有路由器需添加參數: ip classless 。同時在與邊界路由器直接相連的路由器上需添加一個預設網關。
7.3 v.35電纜直連的設置
在相關的埠上設置時鍾速率:clock rate < speed> .
7.4 loopback埠的設置
loopback埠是一個虛擬埠,埠狀態始終處於UP。通過它可以使由BGP相連的AS之間始終保持連系,不會由於邊界路由器埠狀態的改變而發生變化。其具體配置如下:
interface loopback
ip address IP地址 子網掩碼
八、常見問題
8.1如何檢測網路是否通暢?
在網路主機上採用命令ping 來逐端檢測網端。
8.2如何查看路由器配置信息?
在EXEC模式下用show config命令。
8.3如何查看路由器路由信息?
在EXEC模式下用show ip route 命令。
8.4如何查看路由器埠信息?
EXEX模式下用show int <埠號> 命令。
8.5為什麼埠協議已經配置,狀態仍然是down?
在CONFIG模式下,選擇該埠,執行no shutdwon命令。
8.6 config模式有幾種狀態,對應那些操作?
config模式有以下幾種狀態:
· globle config 全局配置操作 exec模式鍵入config t
· interface config 埠配置操作 config模式鍵入int <埠號>
· line config 線路配置操作 config模式鍵入line <線路號>
· router config 路由配置操作 config模式鍵入router<路由協議>
Ⅱ 路由命令
1、寫一個默認路由試試 ip route-staisc 0.0.0.0 0 下一跳IP地址(g0/9的固定IP地址)
2、試試更改下apply next-hop 下一跳IP地址(g0/9的固定IP地址)
Ⅲ 靜態路由的配置命令
靜態路由的配置命令是:
router(config)#hostname A (更改路由器主機名)
A(config)#interface f0/0 (進入介面f0/0)
A(config-if)#ip address 192.168.1.1 255.255.255.0 (設置介面ip地址和子網掩碼)
A(config-if)#no shutdown (啟用介面)
A(config)#interface f0/1
A(config-if)#ip address 192.168.2.1 255.255.255.0
A(config-if)#no shutdown
此網路鏈路為乙太網鏈路,如果是串列鏈路,送出介面也就是本地路由器的串列介面。
(3)命令寫路由擴展閱讀
靜態路由由手動配置,而非動態決定。與動態路由不同,靜態路由是固定的,不會改變,即使網路狀況已經改變或是重新被組態。一般來說,靜態路由是由網路管理員逐項加入路由表。
使用靜態路由的另一個好處是網路安全保密性高。動態路由因為需要路由器之間頻繁地交換各自的路由表,而對路由表的分析可以揭示網路的拓撲結構和網路地址等信息。因此,網路出於安全方面的考慮也可以採用靜態路由。不佔用網路帶寬,因為靜態路由不會產生更新流量。
大型和復雜的網路環境通常不宜採用靜態路由:
一方面,網路管理員難以全面地了解整個網路的拓撲結構;
另一方面,當網路的拓撲結構和鏈路狀態發生變化時,路由器中的靜態路由信息需要大范圍地調整,這一工作的難度和復雜程度非常高。當網路發生變化或網路發生故障時,不能重選路由,很可能使路由失敗。
Ⅳ 華為交換機路由配置命令
華為路由器交換機配置命令:路由器命令
[Quidway]displayversion;顯示版本信息
[Quidway]displaycurrent-configuration;顯示當前配置
[Quidway]displayinterfaces;顯示介面信息
[Quidway]displayiproute;顯示路由信息
[Quidway]sysnameaabbcc;更改主機名
[Quidway]superpasswrod123456;設置口令
[Quidway]interfaceserial0;進入介面
[Quidway-serial0]ipaddress;配置埠IP地址
[Quidway-serial0]undoshutdown;激活埠
[Quidway]link-protocolhdlc;綁定hdlc協議
[Quidway]user-interfacevty04
[Quidway-ui-vty0-4]authentication-modepassword
[Quidway-ui-vty0-4]setauthentication-modepasswordsimple222
[Quidway-ui-vty0-4]userprivilegelevel3
[Quidway-ui-vty0-4]quit
[Quidway]debugginghdlcallserial0;顯示所有信息
[Quidway]debugginghdlceventserial0;調試事件信息
[Quidway]debugginghdlcpacketserial0;顯示包的信息
華為路由器交換機配置命令:靜態路由:
[Quidway]iproute-static{interfacenumber|nexthop}[value][reject|blackhole]
例如:[Quidway]iproute-static129.1.0.01610.0.0.2
[Quidway]iproute-static129.1.0.0255.255.0.010.0.0.2
[Quidway]iproute-static129.1.0.016Serial2
[Quidway]iproute-static0.0.0.00.0.0.010.0.0.2
華為路由器交換機配置命令:動態路由:
[Quidway]rip;設置動態路由
[Quidway]ripwork;設置工作允許
[Quidway]ripinput;設置入口允許
[Quidway]ripoutput;設置出口允許
[Quidway-rip]network1.0.0.0;設置交換路由網路
[Quidway-rip]networkall;設置與所有網路交換
[Quidway-rip]peerip-address;
[Quidway-rip]summary;路由聚合
[Quidway]ripversion1;設置工作在版本1
[Quidway]ripversion2multicast;設版本2,多播方式
[Quidway-Ethernet0]ripsplit-horizon;水平分隔
[Quidway]routeridA.B.C.D;配置路由器的ID
[Quidway]ospfenable;啟動OSPF協議
[Quidway-ospf]import-routedirect;引入直聯路由
[Quidway-Serial0]ospfenablearea;配置OSPF區域
華為路由器交換機配置命令:標准訪問列表命令格式如下:
acl[match-orderconfig|auto];默認前者順序匹配。
rule[normal|special]{permit|deny}[sourcesource-addrsource-wildcard|any]
例:[Quidway]acl10
[Quidway-acl-10]rulenormalpermitsource10.0.0.00.0.0.255
[Quidway-acl-10]rulenormaldenysourceany
華為路由器交換機配置命令:擴展訪問控制列表配置命令
配置TCP/UDP協議的擴展訪問列表:
rule{normal|special}{permit|deny}{tcp|udp}source{|any}destination|any}
[operate]
配置ICMP協議的擴展訪問列表:
rule{normal|special}{permit|deny}icmpsource{|any]destination{|any]
[icmp-code][logging]
華為路由器交換機配置命令:擴展訪問控制列表操作符的含義
equalportnumber;等於
greater-thanportnumber;大於
less-thanportnumber;小於
not-equalportnumber;不等
rangeportnumber1portnumber2;區間
Ⅳ route add 怎麼添加路由的命令
具體操作方法如下:
Ⅵ 華為路由器配置命令
華為路由器配置命令大全
學習華為交換機,就要記得配置基本命令,下面為大家分享的是華為路由器基本配置命令,希望對大家學習華為有所幫助!
一、計算機命令
PCAlogin:root;使用root用戶
password:linux;口令是linux
#shutdown-hnow;關機
#init0;關機
#logout;用戶注銷
#login;用戶登錄
#ifconfig;顯示IP地址
#ifconfigeth0netmask;設置IP地址
#ifconfigeht0netmaskdown;禁用IP地址
#routeadd0.0.0.0gw;設置網關
#routedel0.0.0.0gw;刪除網關
#routeadddefaultgw;設置網關
#routedeldefaultgw;刪除網關
#route;顯示網關
#ping;發ECHO包
#telnet;遠程登錄
二、華為路由器交換機配置命令:交換機命令
[Quidway]discur;顯示當前配置
[Quidway]displaycurrent-configuration;顯示當前配置
[Quidway]displayinterfaces;顯示介面信息
[Quidway]displayvlanall;顯示路由信息
[Quidway]displayversion;顯示版本信息
[Quidway]superpassword;修改特權用戶密碼
[Quidway]sysname;交換機命名
[Quidway]interfaceethernet0/1;進入介面視圖
[Quidway]interfacevlanx;進入介面視圖
[Quidway-Vlan-interfacex]ipaddress10.65.1.1255.255.0.0;配置VLAN的IP地址
[Quidway]iproute-static0.0.0.00.0.0.010.65.1.2;靜態路由=網關
[Quidway]rip;三層交換支持
[Quidway]local-userftp
[Quidway]user-interfacevty04;進入虛擬終端
[S3026-ui-vty0-4]authentication-modepassword;設置口令模式
[S3026-ui-vty0-4]setauthentication-modepasswordsimple222;設置口令
[S3026-ui-vty0-4]userprivilegelevel3;用戶級別
[Quidway]interfaceethernet0/1;進入埠模式
[Quidway]inte0/1;進入埠模式
[Quidway-Ethernet0/1]plex{half|full|auto};配置埠工作狀態
[Quidway-Ethernet0/1]speed{10|100|auto};配置埠工作速率
[Quidway-Ethernet0/1]flow-control;配置埠流控
[Quidway-Ethernet0/1]mdi{across|auto|normal};配置埠平接扭接
[Quidway-Ethernet0/1]portlink-type{trunk|access|hybrid};設置埠工作模式
[Quidway-Ethernet0/1]portaccessvlan3;當前埠加入到VLAN
[Quidway-Ethernet0/2]porttrunkpermitvlan{ID|All};設trunk允許的VLAN
[Quidway-Ethernet0/3]porttrunkpvidvlan3;設置trunk埠的PVID
[Quidway-Ethernet0/1]undoshutdown;激活埠
[Quidway-Ethernet0/1]shutdown;關閉埠
[Quidway-Ethernet0/1]quit;返回
[Quidway]vlan3;創建VLAN
[Quidway-vlan3]portethernet0/1;在VLAN中增加埠
[Quidway-vlan3]porte0/1;簡寫方式
[Quidway-vlan3]portethernet0/1toethernet0/4;在VLAN中增加埠
[Quidway-vlan3]porte0/1toe0/4;簡寫方式
[Quidway]monitor-port;指定鏡像埠
[Quidway]portmirror;指定被鏡像埠
[Quidway]portmirrorint_listobserving-portint_typeint_num;指定鏡像和被鏡像
[Quidway]descriptionstring;指定VLAN描述字元
[Quidway]description;刪除VLAN描述字元
[Quidway]displayvlan[vlan_id];查看VLAN設置
[Quidway]stp{enable|disable};設置生成樹,默認關閉
[Quidway]stppriority4096;設置交換機的優先順序
[Quidway]stproot{primary|secondary};設置為根或根的備份
[Quidway-Ethernet0/1]stpcost200;設置交換機埠的`花費
[Quidway]link-aggregatione0/1toe0/4ingress|both;埠的聚合
[Quidway]undolink-aggregatione0/1|all;始埠為通道號
[SwitchA-vlanx]isolate-user-vlanenable;設置主vlan
[SwitchA]isolate-user-vlansecondary;設置主vlan包括的子vlan
[Quidway-Ethernet0/2]porthybridpvidvlan;設置vlan的pvid
[Quidway-Ethernet0/2]porthybridpvid;刪除vlan的pvid
[Quidway-Ethernet0/2]porthybridvlanvlan_id_listuntagged;設置無標識的vlan
如果包的vlanid與PVId一致,則去掉vlan信息.默認PVID=1。
所以設置PVID為所屬vlanid,設置可以互通的vlan為untagged.
三、華為路由器交換機配置命令:路由器命令
[Quidway]displayversion;顯示版本信息
[Quidway]displaycurrent-configuration;顯示當前配置
[Quidway]displayinterfaces;顯示介面信息
[Quidway]displayiproute;顯示路由信息
[Quidway]sysnameaabbcc;更改主機名
[Quidway]superpasswrod123456;設置口令
[Quidway]interfaceserial0;進入介面
[Quidway-serial0]ipaddress;配置埠IP地址
[Quidway-serial0]undoshutdown;激活埠
[Quidway]link-protocolhdlc;綁定hdlc協議
[Quidway]user-interfacevty04
[Quidway-ui-vty0-4]authentication-modepassword
[Quidway-ui-vty0-4]setauthentication-modepasswordsimple222
[Quidway-ui-vty0-4]userprivilegelevel3
Ⅶ 路由器里的常用命令
路由器常用的命令如下:
1、Router>(用戶模式)、Router>enable (進入特權模式)、Router#(特權模式) 、Router#configure terminal(進入全局配置模式) 、Router(config)# (全局配置模式) 。
2、Router(config)#hostnameXXX (設置路由器主機名) 、Router(config)#enable password 123(設置特權非密口令) 、Router(config)#enable secret123 (設置特權加密口令) 。
3、Router(config)#interface f0/6 (進入埠配置模式 ) 、Router(config-if)# (埠配置模式) 、Router(config)#line consode 0 (進入控制台埠)。
4、Router(config)#line vty 0 4(進入虛擬終端配置模式) 、Router(config- line)# (虛擬終端配置模式) 、Router(config)#router rip (進入rip路由協議配置模式)。
5、Router(config-router) ( rip路由協議配置模式)、Router(config-router)network 159.105.0.0(設置參與RIP協議的網路地址,不支持可變長掩碼,只有IP網路號)。
6、Router(config)#router ospf 63(進入ospf路由協議配置模式)、Router(config-router) # (ospf路由協議配置模式)。
7、Router#write memory(保存配置到路由器的NVRAM中) 、Router#write network tftp (保存配置到 TFTP伺服器中)。
路由器原理:
路由器通過路由決定數據的轉發。轉發策略稱為路由選擇(routing),這也是路由器名稱的由來(router,轉發者)。
作為不同網路之間互相連接的樞紐,路由器系統構成了基於TCP/IP 的國際互聯網路Internet的主體脈絡,也可以說,路由器構成了Internet的骨架。它的處理速度是網路通信的主要瓶頸之一,它的可靠性則直接影響著網路互連的質量。
Ⅷ route add 添加路由的命令
route的命令是手動配置路由表,在本地IP路由表中顯示和修改條目,用不帶參數的routeprint可以查看本地路由表信息,詳細步驟:
1、win+R打開資源管理器輸入:cmd點擊:確定,在cmd裡面輸入:route/?來查看route命令和參數的使用。
Ⅸ 網管常用的路由器命令網路命令介紹
如果你玩過路由器的話,就知道路由器裡面那些很好玩的命令縮寫。
例如,"sh int" 的意思是 "show interface"。
現在 Windows 2000 也有了類似界面的工具,叫做 netsh。
我們在 Windows 2000 的 cmd shell 下,輸入 netsh
就出來:netsh> 提示符,
輸入 int ip 就顯示:
interface ip>
然後輸入 mp ,我們就可以看到當前系統的網路配置:
# Interface IP Configuration
pushd interface ip
# Interface IP Configuration for "Local Area Connection"
set address name = "Local Area Connection" source = static addr = 192.168.1.168
mask = 255.255.255.0
add address name = "Local Area Connection" addr = 192.1.1.111 mask = 255.255.255.0
set address name = "Local Area Connection" gateway = 192.168.1.100 gwmetric = 1
set dns name = "Local Area Connection" source = static addr = 202.96.209.5
set wins name = "Local Area Connection" source = static addr = none
popd
# End of interface IP configuration
上面介紹的是通過交互方式操作的一種辦法。
我們可以直接輸入命令:
"netsh interface ip add address "Local Area Connection" 10.0.0.2 255.0.0.0"
來添加 IP 地址。
如果不知道語法,不要緊的哦!
在提示符下,輸入 ? 就可以找到答案了。方便不方便啊?
原來微軟的東西裡面,也有那麼一些讓人喜歡的玩意兒。可惜,之至者甚少啊!
Windows網路命令行程序
這部分包括:
使用 ipconfig /all 查看配置
使用 ipconfig /renew 刷新配置
使用 ipconfig 管理 DNS 和 DHCP 類別 ID
使用 Ping 測試連接
使用 Arp 解決硬體地址問題
使用 nbtstat 解決 NetBIOS 名稱問題
使用 netstat 顯示連接統計
使用 tracert 跟蹤網路連接
使用 pathping 測試路由器
使用 ipconfig /all 查看配置
發現和解決 TCP/IP 網路問題時,先檢查出現問題的計算機上的 TCP/IP 配置。可以使用 ipconfig 命令獲得主機配置信息,包括 IP 地址、子網掩碼和默認網關。
注意
對於 Windows 95 和 Windows 98 的客戶機,請使用 winipcfg 命令而不是 ipconfig 命令。
使用帶 /all 選項的 ipconfig 命令時,將給出所有介面的.詳細配置報告,包括任何已配置的串列埠。 使用 ipconfig /all,可以將命令輸出重定向到某個文件,並將輸出粘貼到其他文檔中。也可以用該輸出確認網路上每台計算機的 TCP/IP 配置,或者進一步調查 TCP/IP 網路問題。
例如,如果計算機配置的 IP 地址與現有的 IP 地址重復,則子網掩碼顯示為 0.0.0.0。
下面的範例是 ipconfig /all 命令輸出,該計算機配置成使用 DHCP 伺服器動態配置TCP/IP,並使用WINS 和 DNS 伺服器解析名稱。
Windows 2000 IP Configuration
Node Type.. . . . . . . . : Hybrid
IP Routing Enabled.. . . . : No
WINS Proxy Enabled.. . . . : No
Ethernet adapter Local Area Connection:
Host Name.. . . . . . . . : corp1.microsoft.com
DNS Servers . . . . . . . : 10.1.0.200
Description. . . . . . . : 3Com 3C90x Ethernet Adapter
Physical Address. . . . . : 00-60-08-3E-46-07
DHCP Enabled.. . . . . . . : Yes
Autoconfiguration Enabled.: Yes
IP Address. . . . . . . . . : 192.168.0.112
Subnet Mask. . . . . . . . : 255.255.0.0
Default Gateway. . . . . . : 192.168.0.1
DHCP Server. . . . . . . . : 10.1.0.50
Primary WINS Server. . . . : 10.1.0.101
Secondary WINS Server. . . : 10.1.0.102
Lease Obtained.. . . . . . : Wednesday, September 02, 1998 10:32:13 AM
Lease Expires.. . . . . . : Friday, September 18, 1998 10:32:13 AM
如果 TCP/IP 配置沒有問題,下一步測試能夠連接到 TCP/IP 網路上的其他主機。
Ⅹ linux配置路由命令
ip rule是linux中用於配置路由的命令(應該說是ip 命令的route選項),相當於
通過路由表 inr.ruhep 路由來自源地址為192.203.80/24的數據包 windows的route命令;
linux對應的用法是:
ip rule add from 192.167.80/24 table inr.ruhep prio 220
windows 對應的用法是:
route add 192.167.80.0 mask 255.255.255.0
另外,linux還有個命令iptables功能強大得多,可以設置埠轉發,以供外部的主機享用路由規則。