Annotation of wikisrc/users/imil/cheatsheet.mdwn, revision 1.13

1.6       imil        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
1.7       imil       11: """]]
1.6       imil       12: 
1.13    ! imil       13: ## Specify a gateway
        !            14: 
        !            15: [[!template  id=programlisting text="""
        !            16: $ cat /etc/mygate
        !            17: 192.168.0.254
        !            18: """]]
        !            19: 
1.6       imil       20: ## Add an IP alias on a NIC
                     21: 
                     22: [[!template  id=programlisting text="""
                     23: $ cat /etc/ifconfig.fxp0
                     24: up
                     25: inet 192.168.0.1 netmask 0xffffff00
                     26: inet 172.16.0.1 netmask 0xffffffff alias
                     27: """]]
                     28: 
                     29: ## NIC will retrieve its IP address via DHCP
                     30: 
                     31: [[!template  id=programlisting text="""
                     32: $ cat /etc/ifconfig.re0
1.9       imil       33: up
1.6       imil       34: !dhcpcd $int
                     35: """]]
                     36: 
                     37: ## Add a static route when bringing up NIC
                     38: 
                     39: [[!template  id=programlisting text="""
                     40: $ cat /etc/ifconfig.re0
                     41: up
                     42: !dhcpcd $int
                     43: !route -n add -net 10.0.0.0/8 192.168.0.254
                     44: """]]
                     45: 
                     46: ## Specify a media type for a NIC
                     47: 
                     48: [[!template  id=programlisting text="""
                     49: $ cat /etc/ifconfig.re0
                     50: media 100baseTX up
                     51: !dhcpcd $int
                     52: """]]
                     53: 
                     54: ## Add an IPv6 address to a NIC
                     55: 
                     56: [[!template  id=programlisting text="""
                     57: $ cat /etc/ifconfig.re0
                     58: media 100baseTX up
                     59: !dhcpcd $int
                     60: inet6 2001:dead:beef:1::1 prefixlen 64
                     61: """]]
1.1       imil       62: 
1.8       imil       63: ## Very basic pf rules for NAT and firewalling
                     64: 
                     65: [[!template  id=programlisting text="""
                     66: $ cat /etc/pf.conf
                     67: ext_if="sip0"
                     68: int_if="re0"
                     69: 
                     70: nat on $ext_if from !($ext_if) -> ($ext_if:0)
                     71: 
                     72: # allow outgoing traffic (S/A is implied)
                     73: pass out on $ext_if
                     74: # block all incoming traffic
                     75: block in log on $ext_if
                     76: """]]
                     77: 
1.10      imil       78: ## Setup WPA WiFi client
                     79: 
                     80: [[!template  id=programlisting text="""
                     81: # wpa_passphrase WPA-WiFi-SSID my-strong-passphrase >> /etc/wpa_supplicant.conf
                     82: $ grep wpa /etc/rc.conf
                     83: wpa_supplicant=YES
                     84: wpa_supplicant_flags="-B -iath0 -c/etc/wpa_supplicant.conf"
                     85: # /etc/rc.d/wpa_supplicant start
                     86: """]]
                     87: 
1.1       imil       88: ## Upgrade the system with binaries
                     89: 
1.3       imil       90: [[!template  id=programlisting text="""
1.6       imil       91: # cp /netbsd /netbsd.old
                     92: # tar zxvfp kern-MONOLITHIC.tgz -C /
                     93: # sync; sync
                     94: # shutdown -r now
                     95: # for i in base comp games man misc modules tests text xbase xcomp xetc xfont xserver; do tar zxvfp $i.tgz -C /;done
                     96: # mkdir /tmp/temproot
                     97: # tar zxvfp etc.tgz -C /tmp/temproot
1.12      imil       98: # postinstall -s /tmp/temproot check
1.6       imil       99: # # copy postinstall's requirements
1.13    ! imil      100: # etcupdate -s /tmp/temproot
1.6       imil      101: # shutdown -r now
1.3       imil      102: """]]
1.1       imil      103: 
                    104: ## Upgrade the system with sources
                    105: 
                    106: * Build the userland
                    107: 
1.3       imil      108: [[!template  id=programlisting text="""
1.6       imil      109: # cd /usr/src
                    110: # ./build.sh -O ../obj -T ../tools -j#jobs -U distribution
1.4       imil      111: """]]
1.1       imil      112: 
                    113: * Build the kernel
                    114: 
1.3       imil      115: [[!template  id=programlisting text="""
1.6       imil      116: # cd /usr/src
                    117: # ./build.sh -O ../obj -T ../tools -j#jobs kernel=YOUR_KERNEL
1.4       imil      118: """]]
1.1       imil      119: 
                    120: * Install the new kernel
                    121: 
1.3       imil      122: [[!template  id=programlisting text="""
1.6       imil      123: # cd /usr/src
                    124: # cp /netbsd /netbsd.old
                    125: # cp /usr/obj/sys/arch/YOUR_ARCH/compile/YOUR_KERNEL/netbsd /
                    126: # shutdown -r now
                    127: # cd /usr/src
                    128: # ./build.sh -O ../obj -T ../tools -U install=/
                    129: # /usr/sbin/etcupdate -s /usr/src
1.4       imil      130: """]]
1.1       imil      131: 
                    132: ## Adobe Flash
                    133: 
1.3       imil      134: [[!template  id=programlisting text="""
1.6       imil      135: # echo "procfs /emul/linux/proc procfs ro,linux" >> /etc/fstab
                    136: # mount /emul/linux/proc
                    137: # cd /usr/pkgsrc/www/nspluginwrapper
                    138: # make install
                    139: # cd /usr/pkgsrc/multimedia/ns-flash
                    140: # make install
                    141: $ nspluginwrapper -i /usr/pkg/lib/netscape/plugins/libflashplayer.so
1.4       imil      142: """]]
1.3       imil      143: 
1.11      imil      144: ## Mount / umount an iso image
                    145: 
                    146: [[!template  id=programlisting text="""
                    147: # vnconfig -v -c /dev/vnd0d output.iso
                    148: # mount -t cd9660 /dev/vnd0a /mnt
                    149: # [...]
                    150: # umount /mnt
                    151: # vnconfig -u vnd0d
                    152: """]]
                    153: 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb