A simple guide to get your network running.
Load the device module
Add your eth0 module to the modules array in
/etc/rc.conf, eg. tg3
MODULES=(!usbserial tg3 snd-cmipci)
For DHCP IP
/etc/rc.conf like this:
lo="lo 127.0.0.1" eth0="dhcp" INTERFACES=(lo eth0) ROUTES=(!gateway)
For Static IP
If you share your internet connection from a Windows box without a router, be sure to use static IPs on both computers. Otherwise you will have LAN issues.
Your static IP address, The netmask, The broadcast address, Your gateway, Your nameservers' IP addresses, Your domain name.
If you are running a private network, it is safe to use IP addresses in 192.168.*.'* for your IPs, with a netmask of 255.255.0.0 and broadcast address of 192.168.255.255. Unless your network has a router, the gateway address does not matter. Edit
/etc/rc.conf like this, substituting your own values for the IP, netmask, broadcast, and gateway:
lo="lo 127.0.0.1" eth0="eth0 126.96.36.199 netmask 255.255.255.0 broadcast 188.8.131.52" INTERFACES=(lo eth0) gateway="default gw 184.108.40.206" ROUTES=(gateway)
/etc/resolv.conf like this, substituting your nameservers' IPs and your domain name:
nameserver 220.127.116.11 nameserver 61.95.849.8 search example.com
You may include as many nameserver lines as you wish.
If you use DHCP and you don't want your DNS servers to change every time you start your network, be sure to add the
-R option to code>DHCPCD_ARGS</code> in
/etc/conf.d/dhcpcd (used by in
/etc/rc.d/network). This prevents DHCP from rewritting your
/etc/resolv.conf every time:
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"
Set computer name
/etc/rc.conf and set HOSTNAME to your desired computer name :
Set host name/ip
/etc/hosts and add a similar line with the same HOSTNAME you entered at
127.0.0.1 banana.localdomain banana