I've been trying to do this for some time now.
So from what I have gathered what I need is virtual interfaces with different MAC addresses bridged to the physical interface. I think I have accomplished that much.
Code:
gateway# ifconfig nfe0
nfe0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8<VLAN_MTU>
ether 00:14:2a:19:c4:a5
inet 216.232.236.243 netmask 0xfffff000 broadcast 216.232.239.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
gateway# ifconfig ngeth0
ngeth0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:5c:16:10:dd:79
inet 207.6.112.184 netmask 0xfffff000 broadcast 207.6.127.255
gateway#
I followed most of the steps on
http://ezine.daemonnews.org/200406/netgraph.html
Went something like this:
Code:
ngctl mkpeer . eiface hook ether
ifconfig ngeth0 up
ngctl mkpeer ngeth0: bridge lower link0
ngctl name ngeth0:lower mybridge
ngctl connect nfe0: mybridge: lower link1
ngctl connect nfe0: mybridge: upper link2
ngctl connect ngeth0: mybridge: upper link3
ngctl msg nfe0: setautosrc 0
ifconfig ngeth0 link 00:5c:16:10:dd:79
dhclient ngeth0
Everything works great except when I try and use ngeth0 for something like my nat.
Here is my pf.conf:
Code:
ext1="nfe0"
ext2="ngeth0"
int1="rl0"
pc1="10.0.0.2"
pc2="10.0.0.3"
set skip on lo
# nat/rdr
binat on $ext1 from $pc1 to any -> $ext1
nat on $ext2 from !($ext2) -> ($ext2:0)
rdr-anchor "miniupnpd"
# Hamachi
rdr on $ext1 proto {tcp, udp} from any to any port 39004 -> $pc1
# Xbox Live
rdr on $ext1 proto {tcp, udp} from any to any port 3074 -> $pc2
anchor "miniupnpd"
10.0.0.2 works fine, can access the internet everything works. 10.0.0.3 does not work at all. I am guessing its not pf but its how I setup the virtual interface.