忍者ブログ

ブログ内検索

プロフィール

HN:
Ark0046
性別:
男性

リンク

最新コメント

[09/21 brazilian body wav]
[09/14 ベース]
[09/01 クラブフルセット]
[09/01 シティサイクル 通販]
[09/01 アディダス 時計 白]
[09/01 イブサンローラン 財布 レディース]
[08/31 Giuseppe Zanotti ハイカットスニーカー レディース]
[08/31 ガガミラノ 腕時計]
[08/31 ニューバランス 996 メンズ]
[08/31 ナイキ エアジョーダン レディース]

最新トラックバック

忍者アド

アクセス解析

2024.04.27 Sat 00:27:03

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

2009.03.24 Tue 16:25:05

$ sudo vi /etc/sysctl.conf
  #net.ipv4.ip_forward=0
    ↓
  net.ipv4.ip_forward=1
$ sudo sysctl -p
$ sudo /etc/init.d/networking restart

$ sudo vi iptables.sh
================↓=========================================↓==================
#!/bin/sh

# NAT の設定を削除
iptables -F -t nat
# 全てのルールを削除
iptables -F
# 全てのユーザ定義チェインを削除
iptables -X

# ポリシー
iptables -P INPUT DROP    # 受信はすべて破棄
iptables -P OUTPUT ACCEPT # 送信はすべて許可
iptables -P FORWARD DROP  # 通過はすべて破棄

# 接続が確立したパケットは許可
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

# 自ホストからのアクセスをすべて許可
iptables -A INPUT -i lo -j ACCEPT
# ICMP からのアクセスを許可
iptables -A INPUT -p icmp -j ACCEPT

# TCP22番ポート
iptables -A FORWARD -i eth0 -p tcp --dport 22 -j ACCEPT
iptables -t nat -A PREROUTING --dst [転送元サーバ外側IP] -p tcp --dport 22 -j DNAT --to-destination [転送先サーバIP]
iptables -t nat -A POSTROUTING -p tcp --dst [転送先サーバIP] --dport 22 -j SNAT --to-source [転送元サーバ内側IP]
iptables -t nat -A OUTPUT --dst [転送元サーバ外側IP] -p tcp --dport 22 -j DNAT --to-destination [転送先サーバIP]
================↑=========================================↑==================

$ sudo chmod 700 iptables.sh
$ sudo ./iptables.sh

設定内容を保存
$ sudo sh -c "iptables-save -c > /etc/iptables.rules"

起動時に設定を反映させる
$ sudo sh -c "cat > /etc/network/if-pre-up.d/iptables"
> #!/bin/sh
> iptables-restore < /etc/iptables.rules
> exit 0
$ sudo chmod +x /etc/network/if-pre-up.d/iptables
PR

Trackbacks

TRACKBACK URL :

Comments

Comment Form