diff options
Diffstat (limited to 'content-org/bsd.org')
-rw-r--r-- | content-org/bsd.org | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/content-org/bsd.org b/content-org/bsd.org index 2d137d6..22cc903 100644 --- a/content-org/bsd.org +++ b/content-org/bsd.org @@ -753,8 +753,87 @@ LSP for Java/Scala is still a joke, and I refuse to pollute my system with Intel [fn:infinit] Any positive number would be infinite progress compared to zero, or as an old wise man once said: "to have a nickel and to not a nickel is already two nickles". ** FreeBSD +*** Personal use +:PROPERTIES: +:EXPORT_HUGO_MENU: :menu bsd :parent "freebsd-personal" +:END: +**** DONE Switching between WiFi and Ethernet on FreeBSD +CLOSED: [2024-10-26 Sat 20:11] +:PROPERTIES: +:EXPORT_FILE_NAME: switching-wifi-eth +:EXPORT_HUGO_MENU_OVERRIDE: :name "Switching between WiFI and Ethernet" +:EXPORT_HUGO_CUSTOM_FRONT_MATTER+: :abstract How to handle multiple network interfaces? +:END: + +*The problem*: +I have a laptop with built-in WiFi. +Say what you will about WiFi, it's always better to use the good, old cable connection. +I have bought myself a cheap, USB Ethernet adapter (Reltek) which is perfectly detected by FreeBSD, as per =ifconfig(8)=: + +#+begin_src shell name: "aa" +ue0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500 + options=68009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> + ether c8:4d:44:20:6a:1b + inet 10.0.7.197 netmask 0xfffff800 broadcast 10.0.7.255 + media: Ethernet autoselect (1000baseT <full-duplex>) + status: active + nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> +#+end_src + +However, I don't want to remove the WiFi card, but FreeBSD insists on using it for all outgoing connections. + +***** Pre-requisites + +What we need to know: +- names of devices (from =ifconfig(8)=). In my case, WiFi is =wlan0= while the Eth dongle is =ue0= +- default route (from =netstat(1)=): + + #+begin_src shell +netstat -rn | grep default + #+end_src + +Write down the IP shown, in my case it's =10.0.1.1=. + +***** Netif + +Netif is FreeBSD's way to manage network devices. We will can disable WiFi: + +#+begin_src shell +service netif stop wlan0 +#+end_src + +And ensure the dongle (ue0) is enabled: + +#+begin_src shell +service netif restart ue0 +#+end_src + +At this point your WiFi is no longer enabled, and all traffic should go through Ethernet. +If everything works fine - you're done. + +***** Default route + +Disabling a network interface removes its routes. +If you can't reach any location (try =ping(8)=) it may be that you are lacking default route. +We can check it via: +#+begin_src shell +netstat -rn | grep default +#+end_src + +If nothing is returned, your computer does't know to reach other machines. +Luckily, we can re-add it. Remember the address from earlier? + +#+begin_src shell +route add default 10.0.1.1 +#+end_src + +Now everything should work fine! + +***** Alternatives + +As per FreeBSD Guide, you can also try [[https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-aggregation][link aggregation]]. -*** DONE FreeBSD: examples of Jail usage +*** DONE FreeBSD: examples of Jail usage CLOSED: [2023-12-01 Mon 21:29] :PROPERTIES: :EXPORT_FILE_NAME: jails-usage-examples |