この記事は会員限定です。会員登録すると全てご覧いただけます。
Linuxマシンを複数のクライアントからのパケットを処理するルータとして利用する場合、IPフォワード機能をオンにする必要がある。IPv4転送とも呼ばれるこの機能を有効にするには、次のような2つの方法がある。共に、/proc/sys/net/ipv4/ip_forwardファイルの内容を「1」=「有効」にするためのものだ。
linuxconfであればGUIで設定が可能だ。「Enable routing」をチェックすればよい
echo 1>/proc/sys/net/ipv4/ip_forward
次に、一般的には/etc/sysconfig/networkファイルが参照されるが、Red Hat Linux 6.2では/etc/sysctl.confファイルの設定内容が起動時に参照される。Red Hat Linux 6.2ユーザーであれば、次のように/etc/sysctl.confを編集しよう。
NETWORKING=yes HOSTNAME=xxxxxxxx DOMAINNAME=xxxxxxxxxx GATEWAY=192.168.0.1 GATEWAYDEV=eth0 FORWARD_IPV4=yes ←フォワード設定 TIMESERVERATBOOT=no TIMESERVERTYPE=ntp TIMESERVERHOST=(none) TIMESERVERRESYNC=(none)
# Disables IPv4 packet forwarding net.ipv4.ip_forward = 1 ←フォワード設定 # Enables source route verification # This drops packets that come in over interfaces they shouldn't; # (for example, a machine on an external net claiming to be one on your # local network) net.ipv4.conf.all.rp_filter = 1 # Disables automatic defragmentation # Automatic defragmentation is needed for masquerading and Linux # Virtual Server use; it is not needed otherwise. net.ipv4.ip_always_defrag = 0 # Disables the magic-sysrq key kernel.sysrq = 0 # Disables stop-a on the sparc kernel.stop-a = 0
Copyright © ITmedia, Inc. All Rights Reserved.