File:  [NetBSD Developer Wiki] / wikisrc / users / imil / cheatsheet.mdwn
Revision 1.13: download - view: text, annotated - select for diffs
Sat Dec 29 16:10:34 2012 UTC (8 years, 9 months ago) by imil
Branches: MAIN
CVS tags: HEAD
typo + added gateway tip from Matthieu

    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: ## Specify a gateway
   14: 
   15: [[!template  id=programlisting text="""
   16: $ cat /etc/mygate
   17: 192.168.0.254
   18: """]]
   19: 
   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
   33: up
   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: """]]
   62: 
   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: 
   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: 
   88: ## Upgrade the system with binaries
   89: 
   90: [[!template  id=programlisting text="""
   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
   98: # postinstall -s /tmp/temproot check
   99: # # copy postinstall's requirements
  100: # etcupdate -s /tmp/temproot
  101: # shutdown -r now
  102: """]]
  103: 
  104: ## Upgrade the system with sources
  105: 
  106: * Build the userland
  107: 
  108: [[!template  id=programlisting text="""
  109: # cd /usr/src
  110: # ./build.sh -O ../obj -T ../tools -j#jobs -U distribution
  111: """]]
  112: 
  113: * Build the kernel
  114: 
  115: [[!template  id=programlisting text="""
  116: # cd /usr/src
  117: # ./build.sh -O ../obj -T ../tools -j#jobs kernel=YOUR_KERNEL
  118: """]]
  119: 
  120: * Install the new kernel
  121: 
  122: [[!template  id=programlisting text="""
  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
  130: """]]
  131: 
  132: ## Adobe Flash
  133: 
  134: [[!template  id=programlisting text="""
  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
  142: """]]
  143: 
  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