Site icon KerKer 的模組世界

[Juniper] Junos介面IP設定

&NewLine;<p class&equals;"wp-block-paragraph"> 邊做邊學,順便留個筆記,若有錯誤請不吝指教。 <&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">Junos基本操作及root密碼設定可參考我之前的文章:<a href&equals;"https&colon;&sol;&sol;kerker&period;website&sol;juniper-junos&percnt;E5&percnt;9F&percnt;BA&percnt;E6&percnt;9C&percnt;AC&percnt;E6&percnt;93&percnt;8D&percnt;E4&percnt;BD&percnt;9C&percnt;E3&percnt;80&percnt;81root&percnt;E5&percnt;AF&percnt;86&percnt;E7&percnt;A2&percnt;BC&percnt;E8&percnt;A8&percnt;AD&percnt;E5&percnt;AE&percnt;9A&sol;">Juniper Junos基本操作、root密碼設定<&sol;a><&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">所有Juniper相關文章列表:<a href&equals;"https&colon;&sol;&sol;kerker&period;website&sol;juniper-junos-&percnt;E7&percnt;B3&percnt;BB&percnt;E5&percnt;88&percnt;97-&percnt;E6&percnt;96&percnt;87&percnt;E7&percnt;AB&percnt;A0&percnt;E5&percnt;88&percnt;97&percnt;E8&percnt;A1&percnt;A8&sol;">Juniper JunOS 系列文章列表<&sol;a><&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<&excl;--more-->&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">要在Juniper的介面上設定IP,需要在介面上設定family為inet。<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">如果你要設定的介面上已經有一個family ethernet-switching的設定請把它刪掉,因為一個介面不能同時具備Routing介面及Switching介面的特性:<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<pre class&equals;"wp-block-code"><code> root&commat;10&period;0&period;0&period;2&num; delete interfaces ge-0&sol;0&sol;23 unit 0 family ethernet-switching<&sol;code><&sol;pre>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">進入設定模式後使用下列指進入要設定IP的介面下進行編輯:<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<pre class&equals;"wp-block-code"><code> root&commat;10&period;0&period;0&period;2&num; edit interfaces ge-0&sol;0&sol;23 unit 0 <&sol;code><&sol;pre>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">接著使用set address指令進行IP設定:<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<pre class&equals;"wp-block-code"><code> &lbrace;master&colon;0&rcub;&lbrack;edit interfaces ge-0&sol;0&sol;23 unit 0&rsqb;&NewLine; root&commat;10&period;0&period;0&period;2&num; set family inet address 10&period;0&period;0&period;2&sol;30<&sol;code><&sol;pre>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">Juniper在IP設定的遮罩部分是直接使用&sol;來標示,如上方之設定即為IP:10&period;0&period;0&period;2 遮罩:255&period;255&period;255&period;252。<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph"> 設定完成記得要commit才會生效,更多關於commit指令的內容可以參考:<a href&equals;"https&colon;&sol;&sol;kerker&period;website&sol;juniper-junos&percnt;E6&percnt;8F&percnt;90&percnt;E4&percnt;BA&percnt;A4&percnt;E8&percnt;A8&percnt;AD&percnt;E5&percnt;AE&percnt;9Acommit&sol;">Juniper Junos提交設定&lpar;commit&rpar;<&sol;a> <&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">回到命令模式我們可以用指令查看該介面狀態:<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<pre class&equals;"wp-block-code"><code> root&commat;10&period;0&period;0&period;2> show interfaces terse ge-0&sol;0&sol;23 &NewLine; Interface Admin Link Proto Local Remote&NewLine; ge-0&sol;0&sol;23 up down&NewLine; ge-0&sol;0&sol;23&period;0 up down inet 10&period;0&period;0&period;2&sol;30 <&sol;code><&sol;pre>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">我們可以看到已經成功在介面上設定IP了,不過介面的Link仍然是down的狀態,這裡我在另外一台Switch上做了10&period;0&period;0&period;1的IP,並用網路線將它們串起。再次查看介面狀態可以看到Link已經轉換成up了。<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<pre class&equals;"wp-block-code"><code> root&commat;10&period;0&period;0&period;2> show interfaces terse ge-0&sol;0&sol;23 &NewLine; Interface Admin Link Proto Local Remote&NewLine; ge-0&sol;0&sol;23 up up&NewLine; ge-0&sol;0&sol;23&period;0 up up inet 10&period;0&period;0&period;2&sol;30 <&sol;code><&sol;pre>&NewLine;&NewLine;&NewLine;&NewLine;<p class&equals;"wp-block-paragraph">這時候可以嘗試去ping對端的IP確認IP設定無誤。<&sol;p>&NewLine;&NewLine;&NewLine;&NewLine;<pre class&equals;"wp-block-code"><code> root&commat;10&period;0&period;0&period;2> ping 10&period;0&period;0&period;1 &NewLine; PING 10&period;0&period;0&period;1 &lpar;10&period;0&period;0&period;1&rpar;&colon; 56 data bytes&NewLine; 64 bytes from 10&period;0&period;0&period;1&colon; icmp&lowbar;seq&equals;0 ttl&equals;64 time&equals;22&period;719 ms&NewLine; 64 bytes from 10&period;0&period;0&period;1&colon; icmp&lowbar;seq&equals;1 ttl&equals;64 time&equals;16&period;587 ms&NewLine; 64 bytes from 10&period;0&period;0&period;1&colon; icmp&lowbar;seq&equals;2 ttl&equals;64 time&equals;24&period;632 ms&NewLine; 64 bytes from 10&period;0&period;0&period;1&colon; icmp&lowbar;seq&equals;3 ttl&equals;64 time&equals;21&period;865 ms<&sol;code><&sol;pre>&NewLine;

Exit mobile version