99久久99久久精品免观看,国产精品久久久久国产精品,国产黄色录像视频,免费的黄色毛片,国产一区精品普通话对白,色妞妞成人在线观看,最新aⅴ福利在线观看免费

綠色資源網(wǎng):您身邊最放心的安全下載站! 最新軟件|熱門排行|軟件分類|軟件專題|論壇轉(zhuǎn)帖|廠商大全

綠色資源網(wǎng)

技術(shù)教程
您的位置:首頁服務(wù)器類Linux服務(wù)器 → 使用Linux系統(tǒng)架設(shè)安全的網(wǎng)關(guān)

使用Linux系統(tǒng)架設(shè)安全的網(wǎng)關(guān)

我要評論 2009/06/27 12:57:04 來源:綠色資源網(wǎng) 編輯:佚名 [ ] 評論:0 點擊:281次

1、網(wǎng)關(guān)主機(jī)設(shè)置 

服務(wù)器上有兩塊網(wǎng)卡,eth0使用*.*.*.*IP地址連接Internet,eth1連接LAN,則其/etc/network/interfaces的設(shè)置如下:

以下為引用的內(nèi)容:

        
auto lo

  iface lo inet loopback

  auto eth0

  iface eth0 inet static

  address *.*.*.*

  netmask 255.255.255.0

  gateway *.*.*.254

  auto eth1

  iface eth1 inet static

  address 192.168.0.1

  network 192.168.0.0

  netmask 255.255.255.0

  broadcast 192.168.0.255

  當(dāng)然也可以使用ifconfig進(jìn)行配置:

  $ ifconfig eth0 *.*.*.* netmask 255.255.255.0

     $ route add default gw *.*.*.254

  $ ifconfig eth1 192.168.0.1 netmask 255.255.255.0

  dns在/etc/resolv.conf中設(shè)置,修改或添加nameserver字段:

  nameserver 202.120.2.101

  如果ip地址是與mac綁定的,還要修改mac地址:

  $ ifconfig eth0 down

  $ ifconfig eth0 hw ether *:*:*:*:*:*

  $ ifconfig eth0 up

 

 2、IP偽裝(IP-masquerade) 

這時將lan內(nèi)主機(jī)網(wǎng)關(guān)改為192.168.0.1,應(yīng)該能ping通該網(wǎng)關(guān),但是還是連不上internet。要實現(xiàn)LAN內(nèi)的機(jī)器通過共享一個單獨的可訪問外網(wǎng)的IP地址來訪問Internet資源,還需要在網(wǎng)關(guān)上安裝ipmasq。

以下為引用的內(nèi)容:
         $ sudo apt-get install ipmasq

會提示進(jìn)行一些設(shè)置,都默認(rèn)即可。之后lan內(nèi)主機(jī)應(yīng)該就能連上internet了。 

3、端口映射

假設(shè)lan內(nèi)有一ftp192.168.0.2,要從internet上訪問該ftp,需要在網(wǎng)關(guān)主機(jī)上進(jìn)行一定的端口映射。可使用iptables完成。下面是具體實現(xiàn)的腳本例子:

以下為引用的內(nèi)容:
      #!/bin/sh

    /sbin/modprobe iptable_filter

    /sbin/modprobe ip_tables

  /sbin/modprobe iptable_nat

  /sbin/modprobe ip_nat_ftp

  /sbin/modprobe ip_conntrack

  /sbin/modprobe ip_conntrack_ftp

  iptables -F

  iptables -P INPUT ACCEPT

  iptables -P FORWARD ACCEPT

  iptables -P OUTPUT ACCEPT

  iptables -F -t nat

  iptables -t nat -A PREROUTING -p tcp -i eth0 -d 202.120.2.101 --dport 21 -j DNAT --to 192.168.123.6:21

  iptables -t nat -A PREROUTING -p tcp -i eth0 -d 202.120.2.101 --dport 2345 -j DNAT --to 192.168.123.116:3389

  iptables -t nat -A POSTROUTING -s 192.168.123.0/24 -o eth0 -j SNAT --to 202.120.16.34

  echo 1 > /proc/sys/net/ipv4/ip_forward
 

關(guān)鍵詞:Linux,網(wǎng)關(guān)

閱讀本文后您有什么感想? 已有 人給出評價!

  • 0 歡迎喜歡
  • 0 白癡
  • 0 拜托
  • 0 哇
  • 0 加油
  • 0 鄙視