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

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: 
                     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
1.9       imil       26: up
1.6       imil       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: """]]
1.1       imil       55: 
1.8       imil       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: 
1.10      imil       71: ## Setup WPA WiFi client
                     72: 
                     73: [[!template  id=programlisting text="""
                     74: # wpa_passphrase WPA-WiFi-SSID my-strong-passphrase >> /etc/wpa_supplicant.conf
                     75: $ grep wpa /etc/rc.conf
                     76: wpa_supplicant=YES
                     77: wpa_supplicant_flags="-B -iath0 -c/etc/wpa_supplicant.conf"
                     78: # /etc/rc.d/wpa_supplicant start
                     79: """]]
                     80: 
1.1       imil       81: ## Upgrade the system with binaries
                     82: 
1.3       imil       83: [[!template  id=programlisting text="""
1.6       imil       84: # cp /netbsd /netbsd.old
                     85: # tar zxvfp kern-MONOLITHIC.tgz -C /
                     86: # sync; sync
                     87: # shutdown -r now
                     88: # for i in base comp games man misc modules tests text xbase xcomp xetc xfont xserver; do tar zxvfp $i.tgz -C /;done
                     89: # mkdir /tmp/temproot
                     90: # tar zxvfp etc.tgz -C /tmp/temproot
                     91: # postinstall -s /tmp/tmproot check
                     92: # # copy postinstall's requirements
                     93: # etcupdate -s /tmp/tmproot
                     94: # shutdown -r now
1.3       imil       95: """]]
1.1       imil       96: 
                     97: ## Upgrade the system with sources
                     98: 
                     99: * Build the userland
                    100: 
1.3       imil      101: [[!template  id=programlisting text="""
1.6       imil      102: # cd /usr/src
                    103: # ./build.sh -O ../obj -T ../tools -j#jobs -U distribution
1.4       imil      104: """]]
1.1       imil      105: 
                    106: * Build the kernel
                    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 kernel=YOUR_KERNEL
1.4       imil      111: """]]
1.1       imil      112: 
                    113: * Install the new kernel
                    114: 
1.3       imil      115: [[!template  id=programlisting text="""
1.6       imil      116: # cd /usr/src
                    117: # cp /netbsd /netbsd.old
                    118: # cp /usr/obj/sys/arch/YOUR_ARCH/compile/YOUR_KERNEL/netbsd /
                    119: # shutdown -r now
                    120: # cd /usr/src
                    121: # ./build.sh -O ../obj -T ../tools -U install=/
                    122: # /usr/sbin/etcupdate -s /usr/src
1.4       imil      123: """]]
1.1       imil      124: 
                    125: ## Adobe Flash
                    126: 
1.3       imil      127: [[!template  id=programlisting text="""
1.6       imil      128: # echo "procfs /emul/linux/proc procfs ro,linux" >> /etc/fstab
                    129: # mount /emul/linux/proc
                    130: # cd /usr/pkgsrc/www/nspluginwrapper
                    131: # make install
                    132: # cd /usr/pkgsrc/multimedia/ns-flash
                    133: # make install
                    134: $ nspluginwrapper -i /usr/pkg/lib/netscape/plugins/libflashplayer.so
1.4       imil      135: """]]
1.3       imil      136: 
1.11    ! imil      137: ## Mount / umount an iso image
        !           138: 
        !           139: [[!template  id=programlisting text="""
        !           140: # vnconfig -v -c /dev/vnd0d output.iso
        !           141: # mount -t cd9660 /dev/vnd0a /mnt
        !           142: # [...]
        !           143: # umount /mnt
        !           144: # vnconfig -u vnd0d
        !           145: """]]
        !           146: 

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