Sharing Internet connection between GhostBSD and others OS

Add your Tips and tricks to configure and tweak your GhostBSD System here.
Post Reply
Posts: 988
Joined: Wed May 06, 2015 12:46 pm
Has thanked: 0
Been thanked: 0

Sharing Internet connection between GhostBSD and others OS

Post by ASX »

I'm usually connected to Internet thru my WiFi router.
It happens sometimes I need to test/install some OS on some machine that doesn't have a WiFi adapter at all, in this case I connect the machine to my primary GhostBSD machine:

[ Internet ] <-> [ wifi router ] <-> [ GhostBSD ] <- ethernet cable -> [ other OS ]

Note: You can use a straight 1 to 1 cable if both eth devices support autosensing, this is the case for Gigabit capable eth devices, otherwise you need to use a crossed cable when using older non-autosensing eth devices.

How is shared the connection: by using pf filters.
so, be sure to add the following line in your /etc/rc.conf:

Code: Select all

and set up your /etc/pf.conf file as follow:

Code: Select all

nat pass on $ext_if from $int_if:network to any -> ($ext_if:0)

# NAT: translate all LAN addresses to the external IP address 
#nat on $ext_if from to any -> ($ext_if)

pass out quick on $ext_if
pass in  quick on $int_if from $int_if:network
re0 is the name of my Eth device (yours may be dfferent)
wlan0 is the name of my Wifi device
the wifi network is: and the wifi card has an address in that range, say
the eth network is: and the eth device has an address in that range, say

That's all on the GhostBSD machine side.


On the machine you want to connect thru GhostBSD, the INET address must be manually set to something in eth network range, say and you need to set the gateway to the address of the GhostBSD eth device: in my example.

Also, do do forget to set some DNS, say or (google dns)

Post Reply