---
# System prepended metadata

title: IP Route設定

---

# **IP Route 設定**


開啟內網防火牆
```shell=
從內網進比較不會重啟被擋住
vi /etc/sysconfig/iptables

加入規則
-A INPUT -s 10.10.55.0/24 -p tcp -m state --state NEW -m tcp --dport 43439 -j ACCEPT
```

內網登錄
```shell=
ssh nh045@10.10.55.x -p 43439
```

更改網卡設定
```shell=
vi /etc/sysconfig/network-scripts/ifcfg-
```
![](https://hackmd.io/_uploads/HJ_XGmabT.png)



重啟網卡
```shell=
nmcli connection reload
nmcli connection down eno2 && nmcli connection up eno2
```

設定staic route
```shell=
ip rule add from 45.122.252.7 table 100
ip route add 0.0.0.0/0 via 45.122.252.1 table 100 dev eno2
```
查看table內容
```shell=
ip route show tab 100
若無顯示要再下一次上面的ip ro指令
```
網卡連線測試
```shell=
curl --interface eno2 ipinfo.io
```
![](https://hackmd.io/_uploads/SkNElmp-p.jpg)

加入開機啟動
```shell=
vi /etc/rc.local

加入這三行
####Domestic Route
ip rule add from 45.122.252.7 table 100
ip route add 0.0.0.0/0 via 45.122.252.1 table 100 dev eno2
```

![](https://hackmd.io/_uploads/Sk7leQa-p.jpg)
