Bsd connect wifi

FreeBsd linked and disconnect network

  1. linked default route and setup dns
  • create route
1
2
ifconfig <network interface> <self_ip> netmask <255.255.255.0> 
dhclient <network interface>
  • delete route
    1
    route del <ip> 
  • setup default gateway
    1
    route add default <default_gateway>
  1. linked wifi
    1
    2
    3
    4
    5
    6
    7
    use ifconfig to see if NetworkInterface is up 
    ifconfig <NetworkInterface> up
    install net-tools first : apt install net-tools
    wpa_passphrase [SSID_NAME] >> /etc/wpa_supplicant.conf
    wpa_supplicant -B -D <drive> -i <NetworkInterface> -c /etc/wpa_supplicant.conf
    //drive = nl80211
    dhclient <NetworkInterface>
  2. setup static inet
    • at /etc/rc.conf setup:
      1
      2
      3
      4
      5
      6
      hostname="freebsd12"
      ifconfig_em0="DHCP"
      ifconfig_em0_ipv6="inet6 accept_rtadv"
      sshd_enable="YES"
      # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
      dumpdev="AUTO"