File:  [NetBSD Developer Wiki] / wikisrc / users / imil / cheatsheet.mdwn
Revision 1.12: download - view: text, annotated - select for diffs
Wed Aug 8 20:25:57 2012 UTC (9 years, 9 months ago) by imil
Branches: MAIN
CVS tags: HEAD
s,tmproot,temproot,

    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: ## 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: 
   81: ## Upgrade the system with binaries
   82: 
   83: [[!template  id=programlisting text="""
   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/temproot check
   92: # # copy postinstall's requirements
   93: # etcupdate -s /tmp/tmproot
   94: # shutdown -r now
   95: """]]
   96: 
   97: ## Upgrade the system with sources
   98: 
   99: * Build the userland
  100: 
  101: [[!template  id=programlisting text="""
  102: # cd /usr/src
  103: # ./build.sh -O ../obj -T ../tools -j#jobs -U distribution
  104: """]]
  105: 
  106: * Build the kernel
  107: 
  108: [[!template  id=programlisting text="""
  109: # cd /usr/src
  110: # ./build.sh -O ../obj -T ../tools -j#jobs kernel=YOUR_KERNEL
  111: """]]
  112: 
  113: * Install the new kernel
  114: 
  115: [[!template  id=programlisting text="""
  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
  123: """]]
  124: 
  125: ## Adobe Flash
  126: 
  127: [[!template  id=programlisting text="""
  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
  135: """]]
  136: 
  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