linux閘道器設定實驗環境:
2臺linux:redhat 9
1臺xp
實驗過程
1臺linux,兩塊網絡卡
eth0 192.168.0.1 接交換機與內網相連
eth1 192.168.0.100 連線modem 通過adsl撥號
其route內容為
[root@dbpi ppp]# route -n
kernel ip routing table
destination gateway genmask flags metric ref use iface
202.103.29.218 0.0.0.0 255.255.255.255 uh 0 0 0 ppp0
192.168.0.0 0.0.0.0 255.255.255.0 u 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 u 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 u 0 0 0 lo
0.0.0.0 202.103.29.218 0.0.0.0 ug 0 0 0 ppp0
另一台linux 一塊網絡卡
eth0 192.168.0.111 閘道器設為192.168.0.1
檢視route資訊
[root@server1 /]# route -n
kernel ip routing table
destination gateway genmask flags metric ref use iface
192.168.0.0 0.0.0.0 255.255.255.0 u 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 u 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 u 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 ug 0 0 0 eth0
可見預設路由是指向0.1的
在這台機上啟動**
[root@server1 /]# echo 1 > /proc/sys/net/ipv4/ip_forward
原來xp的客戶機指向0.1上網,現在在0.111上啟用了**,可以把xp的閘道器指向0.111
在xp上追蹤,當指向0.111時資訊如下:
c:\documents and settings\administrator>tracert 202.103.24.68
tracing route to ns.wuhan.net.cn [202.103.24.68]
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 192.168.0.111
2 <1 ms <1 ms <1 ms 192.168.0.100
3 * * * request timed out.
4 22 ms 21 ms 21 ms 221.232.250.9 …
8 22 ms 21 ms 22 ms ns.wuhan.net.cn [202.103.24.68]
原來指向0.1時資訊如下:
c:\documents and settings\administrator>tracert 202.103.24.68
tracing route to ns.wuhan.net.cn [202.103.24.68]
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 192.168.0.100
2 * * * request timed out.
3 21 ms 20 ms 21 ms 221.232.250.9 …
7 21 ms 22 ms 21 ms ns.wuhan.net.cn [202.103.24.68]
可以現在多了0.111這一跳.
在111的機器上再加乙個網路的ip
eth0:0 192.168.1.112
此時111的route資訊如下
[root@server1 /]# route -n
kernel ip routing table
destination gateway genmask flags metric ref use iface
192.168.1.0 0.0.0.0 255.255.255.0 u 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 u 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 u 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 u 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 ug 1 0 0 eth0
xp的閘道器設為0.111, 是ping不通另乙個子網的1.112的.
需要再次啟用**
echo 1 > /proc/sys/net/ipv4/ip_forward
這樣xp將閘道器設為0.111之後,既可以上外網,也可以訪問另乙個子網了.
Linux 設定閘道器
以下的實操都是在redhat7.3上 網絡卡是電腦內建的硬體又叫網路介面卡,是用來聯網用的網路介面 mac是網絡卡的標識id 閘道器是用來 訊息的裝置,就是發訊息要經過閘道器 閘道器相當與乙個門口,你要出去必須找到這個門口 路由器就是這個門口,你想出去就要告訴你的電腦門在那 把真實主機變成路由器,手...
linux閘道器設定
1.linux中eth0為外網ip 外網閘道器 外網dns設定,eth1為內網ip 172.22.0.0 16 不設定閘道器 dns。2.啟動linux核心中的ip 功能 使得 net.ipv4.ip forward 1 重啟網路 etc init.d network restart 3.配置ipt...
Linux下的閘道器設定
本 文 將 主 要 介 紹 如 何 利 用 一 臺linux 主 機 來 實 現 網 關 的 功 能。例 如,現 在 有 兩 個 子 網,網 絡 地 址 分 別 是 10.119.140.0 和202.114.3.0。由 於 兩 個 子 網 的 網 絡 地 址 不 相 同,為 了 使 兩 個 子 網...