自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

RedHat7.2下使用IPTABLES實(shí)現(xiàn)IP轉(zhuǎn)發(fā)

系統(tǒng) Linux
在我們熟悉的RedHat7.2系統(tǒng)下使用IPTABLES可以實(shí)現(xiàn)IP轉(zhuǎn)發(fā)的功能,他的具體步驟就在文章里!

RedHat7.2下使用IPTABLES實(shí)現(xiàn)IP轉(zhuǎn)發(fā)其實(shí)挺簡(jiǎn)單的,只要你按照下面文章一步一步走就行!

  1.內(nèi)核編譯

  一般來(lái)講,透明代理所在機(jī)器往往是帶動(dòng)整個(gè)局域網(wǎng)聯(lián)入互聯(lián)網(wǎng)的入口,因此該機(jī)器往往需要配置防火墻規(guī)則以對(duì)內(nèi)部網(wǎng)絡(luò)進(jìn)行防護(hù)。因此在編譯內(nèi)核時(shí)也許要考慮將防火墻支持選項(xiàng)編譯進(jìn)去。

  rpm -q kernel-headers kernel-source make dev86 #檢查RPM包,如果不齊的補(bǔ)齊。

  cd /usr/src/linux-xxxx #進(jìn)入內(nèi)核所在目錄

  一般來(lái)說(shuō)需要在使用make menuconfig命令配置時(shí)打開如下選項(xiàng):

 

  1.   [*]Networking support  
  2.  
  3.   [*]Sysctl support  
  4.  
  5.   [*]Network packet filtering  
  6.  
  7.   [*]TCP/IP networking  
  8.  
  9.   [*]/proc filesystem support  
  10.  
  11.   [*] Kernel/User netlink socket  
  12.  
  13.   [*] Netlink device emulation  
  14.  

 

  上面的部原本上幾乎不用改,以下部份在IP: Netfilter Configuration

 

  1.   [*] Connection tracking (required for masq/NAT)  
  2.  
  3.   [*] FTP protocol support  
  4.  
  5.   [*] IP tables support (required for filtering/masq/NAT)  
  6.  
  7.   <*> limit match support  
  8.  
  9.   [*] MAC address match support  
  10.  
  11.   [*] Netfilter MARK match support  
  12.  
  13.   [*] Multiple port match support  
  14.  
  15.   [*] TOS match support  
  16.  
  17.   [*] Connection state match support  
  18.  
  19.   [*] Packet filtering  
  20.  
  21.   [*] REJECT target support  
  22.  
  23.   [*] Full NAT  
  24.  
  25.   [*] MASQUERADE target support  
  26.  
  27.   [*] REDIRECT target support  
  28.  
  29.   [*] Packet mangling  
  30.  
  31.   [*] TOS target support  
  32.  
  33.   [*] MARK target support  
  34.  
  35.   [*] LOG target support  
  36.  

 

  然后make dep ; make clean ;make bzImage命令來(lái)編譯內(nèi)核。如果使用到了模塊,還需要使用下面命令生成和安裝模塊make modules;make modules-install。

  安裝新內(nèi)核后重新起動(dòng)

  另:/etc/sysconfig/network 為:

  NETWORKING=yes

  HOSTNAME="gateway"

  FORWARD_IPV4=true

  GATEWAYDEV=eth1

#p#

  2.iptables的設(shè)置

  在/etc/rc.d/目錄下用touch命令建立firewall文件,執(zhí)行chmod u+x firewall以更改文件屬性,編輯/etc/rc.d/rc.local文件,在末尾加上/etc/rc.d/firewall以確保開機(jī)時(shí)能自動(dòng)執(zhí)行該腳本?! irewall文件內(nèi)容為:

  #!/bin/sh

  echo "Enabling IP Forwarding..."

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

  echo "Starting iptables rules..."

  #Refresh all chains

  /sbin/rmmod ipchains

  /sbin/modprobe ip_tables

  /sbin/modprobe iptable_filter

  /sbin/modprobe iptable_nat

  /sbin/modprobe ip_conntrack

  /sbin/modprobe ip_conntrack_ftp

  /sbin/modprboe ip_nat_ftp

  /sbin/iptables -F INPUT

  /sbin/iptables -F FORWARD

  /sbin/iptables -F POSTROUTING -t nat

  /sbin/iptables -P FORWARD DROP

  /sbin/iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 -j MASQUERADE #eth1為接Internet的網(wǎng)卡

  #/sbin/iptables –t nat –A POSTROUTING –o ppp0 –j MASQUERADE #用于ppp0撥號(hào)

  /sbin/iptables -A FORWARD -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

  /sbin/iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT

通過(guò)正文的介紹和了解,大家都能在自己的RedHat7.2系統(tǒng)下使用IPTABLES來(lái)實(shí)現(xiàn)IP轉(zhuǎn)發(fā)了,感興趣的朋友可以試試!

【編輯推薦】

 

 

責(zé)任編輯:趙鵬 來(lái)源: 網(wǎng)絡(luò)轉(zhuǎn)載
相關(guān)推薦

2011-03-16 09:05:32

RedhatiptablesNAT

2011-03-16 10:12:27

LinuxIptables端口轉(zhuǎn)發(fā)

2011-03-17 14:26:45

iptables 端口

2011-03-18 10:16:13

LinuxiptablesIP

2014-07-30 14:35:33

LinuxApache

2011-03-16 10:29:17

2011-03-16 12:55:00

iptables 端口

2011-03-16 09:05:33

2011-03-18 08:52:23

Iptables

2011-03-16 09:05:29

iptablesNAT

2011-09-06 16:31:58

iptablesNAT轉(zhuǎn)發(fā)

2011-03-15 15:47:26

LinuxIptables防火墻

2017-10-10 12:40:13

SSHTCPOpenSSH

2011-04-02 16:08:02

2011-03-15 17:12:11

2011-03-17 15:16:38

2011-03-15 16:12:45

iptablesRed Hat

2011-03-15 14:50:03

使用IPTables

2009-11-30 09:56:16

2011-03-17 12:25:55

iptables ft
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)