Add ip NetBSD

From NixTheWorld

Jump to: navigation, search
# echo "inet IPHERE netmask NETMASK" > /etc/ifconfig.DEVICE

e.g., if your device is rtk0, and you want to add 192.168.0.2:

# echo "inet 192.168.0.2 netmask 192.168.0.0/24" > /etc/ifconfig.rtk0
# /etc/rc.d/network restart
# ifconfig -a
rtk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:08:54:df:5d:5b
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
        inet6 fe80::208:54ff:fedf:5d5b%rtk0 prefixlen 64 scopeid 0x1

also define a default router:

# route add default 192.168.0.1
# echo 'defaultrouter="192.168.0.1"' >> /etc/rc.conf
Personal tools