I wanted to have a lab network in my house seperated from my normal network.
As I allready own a Mac Mini I decided to see if I could use it as router and server for my lab.
- Adding an interface and enable IP forwarding
- Enable and configure a DHCP server
- Enable and configure a TFTP server
- Enable and configure a NFS server
Adding an interface and enabling IP forwarding
This was relative easy. I just bought a noname USB Ethernet adapter and inserted it into a USB port of my Mac Mini. It showed up as interface en5
. I configured it with a static IP address as I did with the build in interface (en0
) but for a different subnet.
Then I enabled IP forwarding in the MAC with sysctl -w net.inet.ip.forwarding=1
and to make sure it stays that way after reboots I also edited /etc/sysctl.conf
and inserted the line:
net.inet.ip.forwarding=1
And that was all it took to enable the Mac Mini as router. It even works while I load the Mac Mini by playing Civilication VI on it.
Enabling and configuring a DHCP server
Create a DHCP config file with sudo vi /etc/bootpd.plist
that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>dhcp_enabled</key>
<string>en5</string>
<key>Subnets</key>
<array>
<dict>
<key>name</key>
<string>172.31.155</string>
<key>net_mask</key>
<string>255.255.255.0</string>
<key>net_address</key>
<string>172.31.155.0</string>
<key>net_range</key>
<array>
<string>172.31.155.101</string>
<string>172.31.155.199</string>
</array>
<key>allocate</key>
<true/>
<key>dhcp_router</key>
<string>172.31.155.254</string>
<key>lease_min</key>
<integer>3600</integer>
<key>lease_max</key>
<integer>86400</integer>
<key>dhcp_domain_name_server</key>
<array>
<string>1.1.1.1</string>
<string>8.8.8.8</string>
</array>
</dict>
</array>
</dict>
</plist>
Then start the DHCP server with sudo launchctl load -w /System/Library/LaunchDaemons/bootps.plist
You can verify the DHCP server is now up with netstat -na|grep "\.67"
. And my Raspberry PI’s now get an IP address assigned from the range 172.31.155.101-172.31.155.199 where the first PI in the subnet gets 172.31.155.101 assigned.
Enabling and configuring a TFTP server
Enabling and configuring a NFS server
Other stuff
Current status
Currently this is a work in progress as I build each step I will document it and update this page.
In a sense this is pretty old stuff. I mean, some of it is identical to building a diskless network with Sparc stations. And that is something I did in the early 90’s and dates back even to older times.
Reacties
Er zijn nog geen reacties op dit artikel.
Feedback