1: # My NetBSD cheat sheet
2:
3: Various tasks I use to do on my NetBSD systems.
4:
5: ## Specify an IP address for your NIC
6:
7: [[!template id=programlisting text="""
8: $ cat /etc/ifconfig.fxp0
9: up
10: inet 192.168.0.1 netmask 0xffffff00
11: """]]
12:
13: ## Add an IP alias on a NIC
14:
15: [[!template id=programlisting text="""
16: $ cat /etc/ifconfig.fxp0
17: up
18: inet 192.168.0.1 netmask 0xffffff00
19: inet 172.16.0.1 netmask 0xffffffff alias
20: """]]
21:
22: ## NIC will retrieve its IP address via DHCP
23:
24: [[!template id=programlisting text="""
25: $ cat /etc/ifconfig.re0
26: up
27: !dhcpcd $int
28: """]]
29:
30: ## Add a static route when bringing up NIC
31:
32: [[!template id=programlisting text="""
33: $ cat /etc/ifconfig.re0
34: up
35: !dhcpcd $int
36: !route -n add -net 10.0.0.0/8 192.168.0.254
37: """]]
38:
39: ## Specify a media type for a NIC
40:
41: [[!template id=programlisting text="""
42: $ cat /etc/ifconfig.re0
43: media 100baseTX up
44: !dhcpcd $int
45: """]]
46:
47: ## Add an IPv6 address to a NIC
48:
49: [[!template id=programlisting text="""
50: $ cat /etc/ifconfig.re0
51: media 100baseTX up
52: !dhcpcd $int
53: inet6 2001:dead:beef:1::1 prefixlen 64
54: """]]
55:
56: ## Very basic pf rules for NAT and firewalling
57:
58: [[!template id=programlisting text="""
59: $ cat /etc/pf.conf
60: ext_if="sip0"
61: int_if="re0"
62:
63: nat on $ext_if from !($ext_if) -> ($ext_if:0)
64:
65: # allow outgoing traffic (S/A is implied)
66: pass out on $ext_if
67: # block all incoming traffic
68: block in log on $ext_if
69: """]]
70:
71: ## Upgrade the system with binaries
72:
73: [[!template id=programlisting text="""
74: # cp /netbsd /netbsd.old
75: # tar zxvfp kern-MONOLITHIC.tgz -C /
76: # sync; sync
77: # shutdown -r now
78: # for i in base comp games man misc modules tests text xbase xcomp xetc xfont xserver; do tar zxvfp $i.tgz -C /;done
79: # mkdir /tmp/temproot
80: # tar zxvfp etc.tgz -C /tmp/temproot
81: # postinstall -s /tmp/tmproot check
82: # # copy postinstall's requirements
83: # etcupdate -s /tmp/tmproot
84: # shutdown -r now
85: """]]
86:
87: ## Upgrade the system with sources
88:
89: * Build the userland
90:
91: [[!template id=programlisting text="""
92: # cd /usr/src
93: # ./build.sh -O ../obj -T ../tools -j#jobs -U distribution
94: """]]
95:
96: * Build the kernel
97:
98: [[!template id=programlisting text="""
99: # cd /usr/src
100: # ./build.sh -O ../obj -T ../tools -j#jobs kernel=YOUR_KERNEL
101: """]]
102:
103: * Install the new kernel
104:
105: [[!template id=programlisting text="""
106: # cd /usr/src
107: # cp /netbsd /netbsd.old
108: # cp /usr/obj/sys/arch/YOUR_ARCH/compile/YOUR_KERNEL/netbsd /
109: # shutdown -r now
110: # cd /usr/src
111: # ./build.sh -O ../obj -T ../tools -U install=/
112: # /usr/sbin/etcupdate -s /usr/src
113: """]]
114:
115: ## Adobe Flash
116:
117: [[!template id=programlisting text="""
118: # echo "procfs /emul/linux/proc procfs ro,linux" >> /etc/fstab
119: # mount /emul/linux/proc
120: # cd /usr/pkgsrc/www/nspluginwrapper
121: # make install
122: # cd /usr/pkgsrc/multimedia/ns-flash
123: # make install
124: $ nspluginwrapper -i /usr/pkg/lib/netscape/plugins/libflashplayer.so
125: """]]
126:
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb