Author: Dan
Date: 15-05-09 00:21
Over the past few days, I've had need to turn my laptop into a gateway. I wanted to record the steps because I keep stumbling over them.
On my laptop:
ath0 -connected to my ISP
em0 - connected to my internal switch
internal network is 10.0.0.0/24
- connect to the publc internet:
** ifconfig ath0 up
** dhclient ath0
- bring up em0, which will act as the gateway in my predefined internal network
** ifconfig em0 10.0.0.1 netmask 255.255.255.0
- create my simple NAT rules for pf
# cat /etc/pf.conf
ext_if="ath0"
int_if="em0"
internal_net="10.0.0.0/24"
nat on $ext_if from $internal_net to any -> ($ext_if)
- load pf
# kldload pf
- enable pf
# pfctl -e
No ALTQ support in kernel
ALTQ related functions disabled
pf enabled
- inoke the rules
# pfctl -f /etc/pf.conf
No ALTQ support in kernel
ALTQ related functions disabled
- enable forwarding
# sysctl net.inet.ip.forwarding=1
net.inet.ip.forwarding: 0 -> 1
On the machines inside this temporary network:
- configure the NIC to be inside the network
** ifconfig ale0 10.0.0.2 netmask 255.255.255.0
- set the default router:
# route add default 10.0.0.1
add net default: gateway 10.0.0.1
- make DNS work
# cat /etc/resolv.conf
search wlfdle.phub.net.cable.rogers.com
--
Webmaster
|
|