[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[debian-users:25591] routing with Debian
柴田(あ)hです。
お世話になっております。
またまた network 絡みの質問をいたします。
思い当たるところがあればご指導お願いいたします。
/etc/netwok/interfaces をいじれば一発のような
気がしますが、検索ではソレらしいものを
見つけられませんでした。
【目的】
Firewall を作る(できればカタめに)
ポリシ
・Intranet から外へは自由に出られる
・Internet 側からは Firewall を含めてその先へ
アクセスできないようにする。
【問題】
下記ネットワークと設定にて intranet 側から外へ
routing されない。
現在は ping にて実験。
【状況】
■ネットワーク
下記 hotate から ping を打っています。
NTT
↑
nv1
| 192.168.1.1
| 擬似的に internet 側としています。
| 192.168.1.11
sanma
| 192.168.20.1
| intranet 側
| 192.168.20.15
hotate
ping の結果(hotate から)
192.168.20.15 OK
192.168.20.1 OK
192.168.1.11 OK
192.168.1.1 Fail
ping の結果(sanma から)
192.168.20.15 OK
192.168.20.1 OK
192.168.1.11 OK
192.168.1.1 OK
■ sanma の設定
help@hotate:~$ cat /etc/network/interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
auto eth0
iface eth0 inet static
address 192.168.1.11
network 192.168.1.0
netmask 255.255.255.0
boradcast 192.168.1.255
up route add default gw 192.168.1.1
down route add default gw 192.168.1.1
auto eth1
iface eth1 inet static
address 192.168.20.1
network 192.168.20.0
netmask 255.255.255.0
boradcast 192.168.20.255
up route add default gw 192.168.20.1
down route add default gw 192.168.20.1
route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.20.1
■ sanma の状態(ドメイン名が出てきますがインチキドメインです)
help@hotate:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:60:97:61:B0:98
inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:689 errors:0 dropped:0 overruns:0 frame:0
TX packets:487 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:12 Base address:0xe400
eth1 Link encap:Ethernet HWaddr 00:00:F4:60:9F:13
inet addr:192.168.20.1 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1339 errors:0 dropped:0 overruns:0 frame:0
TX packets:314 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:10 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:88 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
help@hotate:~$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.20.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.20.1 0.0.0.0 UG 0 0 0 eth1
default nv1.naguri.sait 0.0.0.0 UG 0 0 0 eth0
help@hotate:~$ netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 20 sanma.naguri.saitam:ssh saba.naguri.saita:64756 ESTABLISHED
tcp 0 0 *:ssh *:* LISTEN
udp 0 0 192.168.20.1:123 *:*
udp 0 0 sanma.naguri.saitam:123 *:*
udp 0 0 hotate:123 *:*
udp 0 0 *:123 *:*
raw 0 0 *:icmp *:* 7
raw 0 0 *:tcp *:* 7
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 0 [ ] STREAM 54
■ とりあえず routing ができている例(slackware で運用中)
saba:~$ cat /etc/rc.d/rc.local
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
# Attach the loopback device.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
# ---------- Ether0 Setup --------------------
IPADDR="192.168.1.3" # REPLACE with YOUR IP address!
NETMASK="255.255.255.0" # REPLACE with YOUR netmask!
NETWORK="192.168.1.0" # REPLACE with YOUR network address!
BROADCAST="192.168.1.255" # REPLACE with YOUR broadcast address, if you
# have one. If not, leave blank and edit below.
GATEWAY="192.168.1.1" # REPLACE with YOUR gateway address!
# ---------- Ether1 Setup --------------------
IPADDR2="192.168.10.3" # REPLACE with YOUR IP address!
NETMASK2="255.255.255.0" # REPLACE with YOUR netmask!
NETWORK2="192.168.10.0" # REPLACE with YOUR network address!
BROADCAST2="192.168.10.255" # REPLACE with YOUR broadcast address, if you
# Uncomment the line below to configure your ethernet card.
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
/sbin/ifconfig eth1 ${IPADDR2} broadcast ${BROADCAST2} netmask ${NETMASK2}
# adjusting time with ntpdate
/usr/local/bin/ntpdate -u time-nw.nist.gov
#
# IP masquerading
# delete all rules
/sbin/ipfwadm -I -f
/sbin/ipfwadm -O -f
/sbin/ipfwadm -F -f
#
#
/sbin/ipfwadm -F -a m -b -S 192.168.10.0/24 -D 0.0.0.0/0
/sbin/ipfwadm -F -p deny
# End of rc.local
--
あまねく生命に、あまねく知性に、最大の幸福を願う
E-mail:help@xxxxxxxxx