Sharing Internet connection between GhostBSD and others OS

Configuring and tweaking your GhostBSD System.

Sharing Internet connection between GhostBSD and others OS

Postby ASX » Tue Aug 30, 2016 1:03 pm

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
pf_enable=yes


and set up your /etc/pf.conf file as follow:
Code: Select all
ext_if="wlan0"
int_if="re0"
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 192.168.2.0/24 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: 192.168.1.0/24 and the wifi card has an address in that range, say 192.168.1.1
the eth network is: 192.168.2.0/24 and the eth device has an address in that range, say 192.168.2.254

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 192.168.2.1 and you need to set the gateway to the address of the GhostBSD eth device: 192.168.2.254. in my example.

Also, do do forget to set some DNS, say 8.8.8.8 or 8.8.4.4 (google dns)
ASX
Developer
 
Posts: 702
Joined: Wed May 06, 2015 3:46 pm
Location: ITALY
Has thanked: 31 times
Been thanked: 74 times

Sharing Internet connection between GhostBSD and others OS


Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

cron