偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

iptables nat實驗

運維 系統(tǒng)運維
iptables 是與最新的 2.6.x 版本Linux 內(nèi)核集成的 IP 信息包過濾系統(tǒng)。本文將講述一個iptables 的nat實驗過程。

iptablesnat實驗過程如下:

  1、 需求:

  1. 設置iptables,使之成為網(wǎng)關(guān),能通過NAT代理局域網(wǎng)客戶機上internet;

  2. 允許局域網(wǎng)客戶機192.168.1.2-100的地址能上網(wǎng)

  2、 基本的拓撲圖

  

 

  3、 系統(tǒng)及其軟件環(huán)境:

  1.操作系統(tǒng): Red Hat Enterprise Linux AS release 4 (Nahant Update 2)

  2.所需rpm軟件包:

  iptables-1.2.11-3.1.RHEL4

  iptables-ipv6-1.2.11-3.1.RHEL4

  iptables-devel-1.2.11-3.1.RHEL4

  4、 所需設置文件或命令:

  /sbin/iptables

  5、 試驗步驟:

  說明:以下所有操作均服務器(192.168.1.1)上操作

  1. 使用vi 編寫如下腳本

  [root@gdlc ~]# vi fw.sh

  #!/bin/bash

  # Set up a default search path.

  PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"

  export PATH

  # Source function library.

  . /etc/rc.d/init.d/functions

  IPT="/sbin/iptables"

  localnet="192.168.1.0/24"

  ctlip="192.168.1."

  startip=2

  endip=100

  Upnic="eth1"

  Downnic="eth0"

  nat_func () {

  /sbin/modprobe ip_tables

  /sbin/modprobe ip_conntrack_ftp

  /sbin/modprobe ip_nat_ftp

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

  $IPT -F -t filter

  $IPT -F -t nat

  $IPT -F -t mangle

  ###IP MASQUERADE #############

  $IPT -A FORWARD -i $Upnic -m state --state ESTABLISHED,RELATED -j ACCEPT

  $IPT -t nat -A POSTROUTING -o $Upnic -s $localnet -j MASQUERADE

  ###FORWARD CONTRL ############

  declare n1=$startip

  declare n2=$endip

  for ((i=n1;i -A FORWARD -s $ctlip$i -j ACCEPT ;done

  $IPT -A FORWARD -j DROP

  }

  stop (){

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

  $IPT -F -t filter

  $IPT -F -t nat

  $IPT -F -t mangle

  }

  status (){

  $IPT -n -L

  }

  # See how we were called.

  case "$1" in

  start)

  nat_func && echo "IPNAT start : `echo_success`"

  ;;

  stop)

  stop && echo "IPNAT stop : `echo_success`"

  ;;

  status)

  status

  ;;

  *)

  echo $"Usage: $0 {start|stop|status}"

  exit 1

  ;;

  esac

  2. 運行腳本

  [root@gdlc ~]# sh fw.sh start

  IPNAT start : [ OK ]

  [root@gdlc ~]# sh fw.sh stop

  IPNAT stop : [ OK ]

通過上文一系類的說明,我們肯定知道了iptables 的nat實驗過程是怎么樣的,希望對大家有用!

【編輯推薦】

  1. iptables 簡單學習筆記
  2. 在Red Hat上安裝iptables
  3. 搭建基于netfilter/iptables的實驗環(huán)境
  4. 用IPtables限制BT、電驢等網(wǎng)絡流量
  5. 如何使用IPTables實現(xiàn)字符串模式匹配
  6. iptables相關(guān)腳本
  7. 如何使用 IPTables
  8. 如何用iptables實現(xiàn)NAT
責任編輯:趙鵬 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2011-03-17 14:09:03

iptables na

2011-03-16 10:59:57

2011-03-16 09:05:34

iptablesnat

2011-03-15 09:10:47

iptablesNAT

2011-03-15 14:26:23

iptablesNAT

2011-03-16 09:05:32

RedhatiptablesNAT

2011-03-17 15:44:21

2011-03-17 13:55:23

iptablesNAT端口映射

2011-03-16 09:05:29

iptablesNAT

2011-03-17 13:28:49

iptables na

2011-03-16 09:05:33

2011-03-16 09:05:53

NATiptables

2011-03-17 17:40:52

iptables配置

2011-03-15 15:51:12

netfilteriptables

2011-03-17 13:02:07

iptables na

2010-05-27 11:04:32

2011-09-06 16:31:58

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

2011-03-17 11:27:11

Linux iptab

2011-03-16 11:06:55

Iptables防火墻

2011-03-16 11:17:56

IptablesICMP
點贊
收藏

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