How to configure network

How to configure network

Became the root and check the current configuration:

server# ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1 inet6 ::1/128

Check available links:

server# dladm show-link LINK CLASS MTU STATE BRIDGE OVER igb0 phys 1500 up -- -- igb1 phys 1500 up -- --

Let's configure igb0:

server# ifconfig igb0 plumb server# ifconfig igb0 inet 10.10.1.16/24 up server# route add default 10.10.1.1 server# ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 igb0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3 inet 10.10.1.16 netmask ffffff00 broadcast 10.10.1.255 lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1 inet6 ::1/128

and test the link:

server# ping 8.8.8.8 8.8.8.8 is alive

How to store it permanently

Create a file /etc/hostname.[iface], i.e. /etc/hostname.igb0 in our example above with follow contains:

10.10.1.16 netmask 255.255.255.0 broadcast + up

Create a file for the default router:

server# cat /etc/defaultrouter 10.10.1.1

Create a file for the hostname:

server# cat /etc/nodename p1c1

And reboot the server to apply the changes (or do it manually as described in the first part)

Assign address using DHCP

ifconfig <iface> plumb; ifconfig <iface> dhcp