OpenBSD , le routage probleme

Fermé
danibal21 Messages postés 1 Date d'inscription mercredi 14 janvier 2009 Statut Membre Dernière intervention 14 janvier 2009 - 14 janv. 2009 à 00:45
 no - 25 janv. 2009 à 19:49
Bonjour,

Je cherche a créer un routeur avec une tour sous OpenBSD 4.4 pour bien comprendre je vous explique comment est fait mon réseau.

J'ai un modem câble qui reçois internet , il est connecter a mon routeur Dlink . Le Dlink envoie vers un routeur sans fil et 2 ordinateur , celui du bureau en haut et un vers ma tour en bas. Ne voulant pas acheter 100 pi de câble supplémentaire je décide de me monte un serveur OpenBSD pour renvoyer internet vers mon 2ieme pc dans la cave.

Mais apres avoir lu plein de truc partout sur le routage avec Packet Filter rien ne marche.

les adresse ip . Mon dlink : 192.168.0.1
Serveur BSD deux carte : sis0 - 192.168.0.101
rl0 - 192.168.2.1
pc-Window : 192.168.2.32

# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33204
groups: lo
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
sis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 00:11:2f:7e:b7:9d
groups: egress
media: Ethernet autoselect (100baseTX full-duplex)
status: active
inet6 fe80::211:2fff:fe7e:b79d%sis0 prefixlen 64 scopeid 0x1
inet 192.168.0.101 netmask 0xffffff00 broadcast 192.168.0.255
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 00:50:ba:84:e4:18
media: Ethernet autoselect (100baseTX full-duplex)
status: active
inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
inet6 fe80::250:baff:fe84:e418%rl0 prefixlen 64 scopeid 0x2
enc0: flags=0<> mtu 1536
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33204
groups: pflog

# cat /etc/dhcpd.conf
# $OpenBSD: dhcpd.conf,v 1.1 1998/08/19 04:25:45 form Exp $
#
# DHCP server options.
# See dhcpd.conf(5) and dhcpd(8) for more information.
#

# Network: 192.168.1.0/255.255.255.0
# Domain name: my.domain
# Name servers: 192.168.1.3 and 192.168.1.5
# Default router: 192.168.1.1
# Addresses: 192.168.1.32 - 192.168.1.127
#
shared-network LOCAL-NET {

option domain-name-servers 24.200.241.37 , 24.201.245.77 ;
option routers 192.168.2.1;
subnet 192.168.2.0 netmask 255.255.255.0 {


range 192.168.2.32 192.168.2.127;
}
}

# cat /etc/pf.conf
# $OpenBSD: pf.conf,v 1.37 2008/05/09 06:04:08 reyk Exp $
#
# See pf.conf(5) for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.

ext_if="sis0"

int_if="rl0"
unsafe="{ rl1 }"
services = "{ ssh, http, https, smtp, domain, pop3, pop3S }"
#nonroutable = "{ 192.168.0.0/16, 127.0.0.0/8}"



#table <spamd-white> persist

nat on $ext_if from $int_if:network to any -> ($ext_if)
pass out on $ext_if proto tcp to any port $services
pass out on $ext_if proto udp to any port $services

set skip on lo

scrub in

#nat-anchor "ftp-proxy/*"
#rdr-anchor "ftp-proxy/*"
#rdr-anchor "relayd/*"
#nat on $ext_if from !($ext_if) -> ($ext_if:0)
#rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
#no rdr on $ext_if proto tcp from <spamd-white> to any port smtp
#rdr pass on $ext_if proto tcp from any to any port smtp \
# -> 127.0.0.1 port spamd

#anchor "ftp-proxy/*"
#anchor "relayd/*"
#block in
#pass out

#pass quick on $int_if no state
#antispoof quick for { lo $int_if }

#pass in on $ext_if proto icmp to ($ext_if)
#pass in on $ext_if proto tcp to ($ext_if) port ssh
#pass in log on $ext_if proto tcp to ($ext_if) port smtp
#pass out log on $ext_if proto tcp from ($ext_if) to port smtp


Du pc window je peu me connecter au serveur BSD , mais impossible de pouvoir aller vers internet ou de faire un ping sur le Dlink.

J'ai initialise le inet_forwarding comme explique dans le tutoriel officiel de OpenBSD dans la section réseau.
Pf est initialise aussi.

Quelqu'un a une idée?

1 réponse

lut,

==> nat ok
# cat /etc/pf.conf | grep nat
nat on $ext_if inet from !$ext_if -> $ext_if
# pfctl -sn
nat on fxp1 inet from ! 172.18.4.122 to any -> 172.18.4.122

==> ip forwarding a 1
# sysctl net.inet.ip.forwarding
net.inet.ip.forwarding=1

==>depuis le bsd tu ping le dlink ?
# pfctl -sr
pass in all flags S/SA keep state
pass out all flags S/SA keep state

==>rajoute le tps de faire tes tests (a la fin du pf.conf)
pass in all
pass out all

==> flush et recharge
pfctl -F all && pfctl -ef /etc/pf.conf

==>verifier pf.conf pr la syntaxe
pfctl -nf /etc/pf.conf

sinon tout simplement,
comment as tu conf la gateway sur le bsd ?
# cat /etc/mygate
193.136.54.11
puis
# cat /etc/mygate | xargs ping
PING 193.136.54.11 (193.136.54.11): 56 data bytes
64 bytes from 193.136.54.11: icmp_seq=0 ttl=64 time=1.249 ms

++
0