---
# System prepended metadata

title: 'Week9 Static Routing, Dynamic Routing and Routing Information Protocol'

---

Week9 Static Routing, Dynamic Routing and Routing Information Protocol
===

* Static routing
    * 網管很可憐，要一直設定XD
* Dynamic routing
    * router 會聊天
* Ip Routing Command
    ![](https://i.imgur.com/2x3n9IM.png)

## 情境
### Static routing
![](https://i.imgur.com/luSJSDu.png)

* 要從 Router 1 設定 route 到 192.168.4.0
    * `ip route 192.168.4.0 255.255.255.0 gigabitEthernet 0/0`
* 從 Router 2 設定 route 到 192.168.1.0
    * `ip route 192.168.1.0 255.255.255.0 192.168.3.1`
* 從 Company 設 route 到 192.168.4.0
    * `ip route 192.168.4.0 255.255.255.0 gigabitEthernet 0/1`
* 從 Company 設 route 到 192.168.1.0
    * `ip route 192.168.1.0 255.255.255.0 192.168.2.1`
* 設定 default route
    * `ip route 0.0.0.0 0.0.0.0 <interface>`
    * 或 `ip route 0.0.0.0 0.0.0.0 <ip address>`
    * 接著 `router rip`、`default-information originate`

### Dynamic Routing
* 只要設 router 上可以去哪就好
    * `route rip` 來開啟 rip
    * `network 192.168.2.0`、`network 192.168.1.0`
* `show ip route` 可以看到類似 [120, 2]，120 代表 rip，2 代表 hop-count(因為是 rip)
* auto-summary
    * 有 auto-summary 的話會讓很多個內網 ip 整合成一個 slash 小的
    * `router rip`、`R2(config-router)# no auto-summary`
`