Pages

Sunday, October 23, 2011

Configuring network and SSH in NetBSD

I have set up my old workstation (AMD Duron with 1.2GHz and 512MB of Ram) with the current NetBSD release 5.1 to play a little around with it. I installed it in a VM (without any networking hardware) directly on the harddisk and after installation I placed the harddisk into the computer. When the OS is booted, I took a look at the networking hardware: 

# ifconfig -a
...
tlp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:10:dc:2f:86:6c
        media: Ethernet autoselect (100baseTX full-duplex)

...

To set an IP permanently I have to configure /etc/ifconfig.tlp0

# vi /etc/ifconfig.tlp0
inet 192.168.1.77 netmask 255.255.255.192

The default route is set in /etc/mygate:

# vi /etc/mygate
192.168.1.73

Edit /etc/resolv.conf for DNS:

# vi /etc/resolv.conf
domain example.com
search example.com
nameserver 192.168.1.73

And finally set the name of the machine in /etc/myname:

# vi /etc/myname
netbsd01

Reboot the machine to check if the settings will be set while booting. If everything works then configure SSH. If you want to login as root via ssh then edit the sshd_config file first:

# vi /etc/ssh/sshd_config
...
PermitRootLogin yes
...

Then add sshd to rc.conf at the end:

# vi /etc/rc.conf
...
sshd=YES

Finally, first start your network:

# /etc/rc.d/network start
...

And then ssh:

# /etc/rc.d/sshd start
...

The script will first create the host keys and then start the ssh daemon. From this point you should be able to login as root over your network into your NetBSD machine.

No comments:

Post a Comment