version 1.4, 2012/07/25 20:06:40
|
version 1.11, 2012/07/27 14:37:11
|
Line 1
|
Line 1
|
# NetBSD cheat sheet |
# My NetBSD cheat sheet |
|
|
|
Various tasks I use to do on my NetBSD systems. |
|
|
|
## Specify an IP address for your NIC |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/ifconfig.fxp0 |
|
up |
|
inet 192.168.0.1 netmask 0xffffff00 |
|
"""]] |
|
|
|
## Add an IP alias on a NIC |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/ifconfig.fxp0 |
|
up |
|
inet 192.168.0.1 netmask 0xffffff00 |
|
inet 172.16.0.1 netmask 0xffffffff alias |
|
"""]] |
|
|
|
## NIC will retrieve its IP address via DHCP |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/ifconfig.re0 |
|
up |
|
!dhcpcd $int |
|
"""]] |
|
|
|
## Add a static route when bringing up NIC |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/ifconfig.re0 |
|
up |
|
!dhcpcd $int |
|
!route -n add -net 10.0.0.0/8 192.168.0.254 |
|
"""]] |
|
|
|
## Specify a media type for a NIC |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/ifconfig.re0 |
|
media 100baseTX up |
|
!dhcpcd $int |
|
"""]] |
|
|
|
## Add an IPv6 address to a NIC |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/ifconfig.re0 |
|
media 100baseTX up |
|
!dhcpcd $int |
|
inet6 2001:dead:beef:1::1 prefixlen 64 |
|
"""]] |
|
|
|
## Very basic pf rules for NAT and firewalling |
|
|
|
[[!template id=programlisting text=""" |
|
$ cat /etc/pf.conf |
|
ext_if="sip0" |
|
int_if="re0" |
|
|
|
nat on $ext_if from !($ext_if) -> ($ext_if:0) |
|
|
|
# allow outgoing traffic (S/A is implied) |
|
pass out on $ext_if |
|
# block all incoming traffic |
|
block in log on $ext_if |
|
"""]] |
|
|
|
## Setup WPA WiFi client |
|
|
|
[[!template id=programlisting text=""" |
|
# wpa_passphrase WPA-WiFi-SSID my-strong-passphrase >> /etc/wpa_supplicant.conf |
|
$ grep wpa /etc/rc.conf |
|
wpa_supplicant=YES |
|
wpa_supplicant_flags="-B -iath0 -c/etc/wpa_supplicant.conf" |
|
# /etc/rc.d/wpa_supplicant start |
|
"""]] |
|
|
## Upgrade the system with binaries |
## Upgrade the system with binaries |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
# cp /netbsd /netbsd.old |
# cp /netbsd /netbsd.old |
# tar zxvfp kern-MONOLITHIC.tgz -C / |
# tar zxvfp kern-MONOLITHIC.tgz -C / |
# sync; sync |
# sync; sync |
# shutdown -r now |
# shutdown -r now |
# for i in base comp games man misc modules tests text xbase xcomp xetc xfont xserver; do tar zxvfp $i.tgz -C /;done |
# for i in base comp games man misc modules tests text xbase xcomp xetc xfont xserver; do tar zxvfp $i.tgz -C /;done |
# mkdir /tmp/temproot |
# mkdir /tmp/temproot |
# tar zxvfp etc.tgz -C /tmp/temproot |
# tar zxvfp etc.tgz -C /tmp/temproot |
# postinstall -s /tmp/tmproot check |
# postinstall -s /tmp/tmproot check |
# # copy postinstall's requirements |
# # copy postinstall's requirements |
# etcupdate -s /tmp/tmproot |
# etcupdate -s /tmp/tmproot |
# shutdown -r now |
# shutdown -r now |
"""]] |
"""]] |
|
|
## Upgrade the system with sources |
## Upgrade the system with sources |
Line 21
|
Line 99
|
* Build the userland |
* Build the userland |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
# cd /usr/src |
# cd /usr/src |
# ./build.sh -O ../obj -T ../tools -j<njobs> -U distribution |
# ./build.sh -O ../obj -T ../tools -j#jobs -U distribution |
"""]] |
"""]] |
|
|
* Build the kernel |
* Build the kernel |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
# cd /usr/src |
# cd /usr/src |
# ./build.sh -O ../obj -T ../tools -j<njobs> kernel=<KERNEL> |
# ./build.sh -O ../obj -T ../tools -j#jobs kernel=YOUR_KERNEL |
"""]] |
"""]] |
|
|
* Install the new kernel |
* Install the new kernel |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
# cd /usr/src |
# cd /usr/src |
# cp /netbsd /netbsd.old |
# cp /netbsd /netbsd.old |
# cp /usr/obj/sys/arch/<ARCH>/compile/<KERNEL>/netbsd / |
# cp /usr/obj/sys/arch/YOUR_ARCH/compile/YOUR_KERNEL/netbsd / |
# shutdown -r now |
# shutdown -r now |
# cd /usr/src |
# cd /usr/src |
# ./build.sh -O ../obj -T ../tools -U install=/ |
# ./build.sh -O ../obj -T ../tools -U install=/ |
# /usr/sbin/etcupdate -s /usr/src |
# /usr/sbin/etcupdate -s /usr/src |
"""]] |
"""]] |
|
|
## Adobe Flash |
## Adobe Flash |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
# echo "procfs /emul/linux/proc procfs ro,linux" >> /etc/fstab |
# echo "procfs /emul/linux/proc procfs ro,linux" >> /etc/fstab |
# mount /emul/linux/proc |
# mount /emul/linux/proc |
# cd /usr/pkgsrc/www/nspluginwrapper |
# cd /usr/pkgsrc/www/nspluginwrapper |
# make install |
# make install |
# cd /usr/pkgsrc/multimedia/ns-flash |
# cd /usr/pkgsrc/multimedia/ns-flash |
# make install |
# make install |
$ nspluginwrapper -i /usr/pkg/lib/netscape/plugins/libflashplayer.so |
$ nspluginwrapper -i /usr/pkg/lib/netscape/plugins/libflashplayer.so |
|
"""]] |
|
|
|
## Mount / umount an iso image |
|
|
|
[[!template id=programlisting text=""" |
|
# vnconfig -v -c /dev/vnd0d output.iso |
|
# mount -t cd9660 /dev/vnd0a /mnt |
|
# [...] |
|
# umount /mnt |
|
# vnconfig -u vnd0d |
"""]] |
"""]] |
|
|