IOS Network Command

進入單一網路介面
(config)#int < interface>
(config-if)#

進入多個網路介面,設定可一次作用在多個介面
(config)#int range < multi interface>
(config-if-range)#
使用commas指定多個介面,使用dash指定連續介面
ps:ios12.1t以上支援
ex:
進入fa0/1,fa0/2,fa0/3,fa0/9的介面
(config)#int range fa0/1-3,fa0/9
(config-if-range)#

將多個介面設為群組
1定義群組
(config)# define interface-range < macro-name> type < multi interface>
2進入介面
(config)# interface range macro < macro-name>
(config-if-range)#
ex:
定義fa0/1,fa0/2,fa0/3,fa0/9的介面
(config)#define interface-range apgroup fa0/1-3,fa0/9
(config)#interface range macro apgroup
(config-if-range)#

… 

啟用網路介面
(config)#int < interface>
(config-if)#no shutdown

設定介面ip
(config-if)#ip address < ip> < mask> [secondary]
ps:若要更改ip,mask設定,只需輸入一次即可覆蓋原本設定
[secondary]可在該介面增加第2個ip,但不建議使用
ex:設定ethernet0介面,ip為192.168.1.2/24,並增加第二個ip為192.168.1.3/24
(config)#int ethernet0
(config-if)#ip address 192.168.1.2 255.255.255.0
(config-if)#ip address 192.168.1.3 255.255.255.0 secondary
(config-if)#no shutdown

設定loopback ip
(config)#interface loopback [number]
(config-if)#ip address < ip-address> < subnet-mask>

ps:loopback介面的mask可用255.255.255.255,代表一個主機

設定介面說明
(config-if)#description < description>
ps:在switch 1900不支援空格

設定乙太網路介面的duplex mode
(config-if)#duplex < auto|full|half>
auto:Enable AUTO duplex configuration
 會先用full mode,失敗在換成half mode,每當介面有變動時會在重做一次 
full:Force full duplex operation
half:Force half-duplex operation
ps:兩端雙工模式要符合才可互連

設定介面的speed
(config-if)# speed <10 | 100 | 1000 | auto> 
auto(default):Enable AUTO speed configuration
ps:
Gigabit Ethernet GBIC ports:always are set to a speed of 1000
Fast Ethernet 10/100 ports:can be set to speeds of 10,100,Auto
1000BASE-T ports:can be set to speeds of 10,100,1000,Auto 

ps:
10Mbps Ethernet link(fixed speed) defaults to half duplex
100Mbps Fast Ethernet(dual speed 10/100) link defaults to full duplex
Multispeed links default to autonegotiate the duplex mode

…………………..

設定所有fast介面的mtu以支援jumbo frame
(config)#system mtu < mtusize> 

設定所有giga介面的mtu以支援jumbo frame
(config)#system mtu jumbo < mtusize>
ex:
2970(config)# system mtu jumbo 9000
2970(config)# exit
2970# reload

………………. 

設定主機表
(config)#[no ]ip host < name> < ip>
ex:(config)#ip host taipei 192.168.10.1

啟動dns查詢
(config)#[no] ip domain-lookup
[no]為關閉此功能,預設是啟動

設定dns server位置
(config)#ip name-server < dns ip> [dns ip2 [dns ip3]…]
最多可設6個dns server

附加網域到所輸入的主機名稱
(config)#ip domain-name < fqdn>

檢視主機表及暫時性的dns記錄
>show hosts
畫面大致如下
Default domain is noko.com   //由ip domain-name設定
Name/address lookup uses domain service
Name servers are 192.168.023   //由ip name-server設定
Host Flags Age Type Address(es)
taipei (perm, OK) 0 IP 192.168.10.1 //perm表示使用ip host手動輸入
1900S.noko.com (temp, OK) 0 IP 192.168.0.32 //temp表示由dns server解析來的

……………………….

顯示多重存取網路上的IGMP query router
#show ip igmp interface < interface>

顯示IGMP目前的IP群播組
#show ip igmp group

啟用IGMP snooping讓設備知道那個介面有IGMP的活動
#ip igmp snooping

指定vlan使用IGMP snoooping
#ip igmp snooping vlan < vlanid>