Subject: problems configuring NAT
To: None <netbsd-help@netbsd.org>
From: Purrcat <purrcat@francine.edoropolis.org>
List: netbsd-help
Date: 02/26/2000 19:10:03
Hi,

I've installed NetBSD on an Alpha and I'm trying to get NAT to work
with no success until now. The output (errors) generated by ipf and
ipnat suggest I didn't configure my kernel corrrectly but I can't seem
to find the problem.. When I look at the network traffic with tcpdump,
I see my internal IP addresses (via ep1 still appear on the external
interface (ep0)). Here's some output of ipnat and ipf:

--
francine# ipf -E -Fa -f /etc/ipf.conf
ioctl(SIOCADDFR): Invalid argument
ioctl(SIOCADDFR): Invalid argument
francine#

francine# ipnat -F -f /etc/ipnat.conf
0 entries flushed from NAT table
ioctl(SIOCADNAT): Invalid argument
ioctl(SIOCADNAT): Invalid argument
francine#
--

This makes me conclude that I haven't built the kernel correctly; however,
I added the following to my kernel configuration (and recompiled it of course):

--
# Added for NAT support
options         GATEWAY
options         IPFORWARDING
options         PFIL_HOOKS
pseudo-device   ipfilter        1
--

I've copied the kernel (netbsd) to / so this shouldn't be the problem.
Sysctl sais IP forwarding is enabled:
net.inet.ip.forwarding = 1
(net.inet.ip.redirect is also 1; I don't know if this is relevant)

I hope anyone can help me on this. See the end of this mail for my ipnat
and ipf configs but I guess these are not relevant as _ioctl_ complains..
(ps: I'm not on this mailing list so when replying, please add my address
too)

-- Khamba Staring


-- ipf.conf
# file: /etc/ipf.conf
#
pass in from any to any
pass out from any to any
--

-- ipnat.conf
#!/sbin/ipnat -f -
# file: /etc/ipnat.conf
#
map ep0 192.168.1.0/24 -> 131.174.116.55/32 portmap tcp/udp 40000:60000
map ep0 192.168.1.0/24 -> 131.174.116.55/32
--

-- ifconfig output
ep0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:a0:24:7c:c0:ba
        media: Ethernet 10baseT
        inet 131.174.116.55 netmask 0xfffffc00 broadcast 131.174.119.255
ep1: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:20:af:8f:73:34
--