Discussion
Loading...

#Tag

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Stefano Marinelli boosted
Eugene :freebsd: :emacslogo:
Eugene :freebsd: :emacslogo:
@evgandr@mastodon.bsd.cafe  ·  activity timestamp last week

So, after I met problems with iwlwifi driver and my attempts to aggregate both em0 and wlan0 interfaces to the one lagg0 interface (https://mastodon.bsd.cafe/@evgandr/115985853500057386) — looks like I found a much (MUCH!) simpler solution drgn_happy

I wanted to automatically switch between wired and wireless networks when I plug-in (or disconnect) my Ethernet cable. First, because I was a newbie in the FreeBSD world, I tried to search for some kind of NetworkManager. Thankfully, I didn't find any NetworkManager clone ported to the FreeBSD. I found some tries to port NetworkManager from Linux to FreeBSD but all of them are failed (not surprised, lol).

Then, I finally started to read documentation drgn_think_science . In the section about advanced networking I read about aggregation interfaces. And somehow I managed to aggregate both of em0 and wlan0 to the one lagg0 interface and it works well.

But, looks like (see https://mstdn.social/@erikarn/115986265106931691) it is not the way how the lagg interfaces should work. It is not intended to use wireless interfaces in the aggregate interfaces — so my tricky setup stopped working in the FreeBSD 15.0.

BUT, since we have a beautiful devd daemon, which listens for various system events and able to execute actions when event is happened — I just wrote 23 lines of shell script to learn my laptop how to switch between interfaces when the Ethernet cable (dis)connects, lol. Solution is very simple:

First, we already have /etc/devd/dhclient.conf, which starts dhclient when some interface appeared in the system. I modified it, so it calls the sPeCiAL script, each time when em0, or wlan0, or ue0 interface appeared in the system, or when em0 is disappeared:

notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "ethernet";
action "/root/bin/unfuck_network.tcsh $subsystem ifup";
};

notify 0 {
match "system" "IFNET";
match "type" "LINK_DOWN";
media-type "ethernet";
action "/root/bin/unfuck_network.tcsh $subsystem ifdown";
};

notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "802.11";
action "/root/bin/unfuck_network.tcsh $subsystem";
};

notify 0 {
match "system" "ETHERNET";
match "type" "IFATTACH";
match "subsystem" "ue0";
action "/root/bin/unfuck_network.tcsh ue0";
};

Then, the main magic happens in the /root/bin/unfuck_network.tcsh:
— When Ethernet cable is connected — it destroys the wlan0 interface and starts dhclient for em0 to talk with DHCP server.
— When Ethernet cable is disconnected — it makes all to remove route using em0 from routing table (removes em0 interface completely, flush routing table, etc — somehow em0 still stays in the routing table if interface is not destroyed; btw system will create it anyway later, in some point) and recreates the wlan0 interface.
— When wlan0 device is created — it starts dhclient for it.

Script contents (for tcsh):
#!/bin/tcsh

switch ( $1 )
case "em0":
if ( $2 == "ifup" ) then
service netif quietstop wlan0
service dhclient quietstart em0
else if ( $2 == "ifdown" ) then
service dhclient quietstop em0
ifconfig em0 delete
route flush
service routing restart
service netif quietstart wlan0
endif
breaksw;
case "wlan0":
service dhclient quietstart wlan0
breaksw;
case "ue0":
service dhclient quietstart ue0
breaksw;
endsw

#FreeBSD #FreeBSD150RELEASE #wifi #tcsh #devd #iwm

  • Copy link
  • Flag this post
  • Block
Eugene :freebsd: :emacslogo:
Eugene :freebsd: :emacslogo:
@evgandr@mastodon.bsd.cafe  ·  activity timestamp last week

So, after I met problems with iwlwifi driver and my attempts to aggregate both em0 and wlan0 interfaces to the one lagg0 interface (https://mastodon.bsd.cafe/@evgandr/115985853500057386) — looks like I found a much (MUCH!) simpler solution drgn_happy

I wanted to automatically switch between wired and wireless networks when I plug-in (or disconnect) my Ethernet cable. First, because I was a newbie in the FreeBSD world, I tried to search for some kind of NetworkManager. Thankfully, I didn't find any NetworkManager clone ported to the FreeBSD. I found some tries to port NetworkManager from Linux to FreeBSD but all of them are failed (not surprised, lol).

Then, I finally started to read documentation drgn_think_science . In the section about advanced networking I read about aggregation interfaces. And somehow I managed to aggregate both of em0 and wlan0 to the one lagg0 interface and it works well.

But, looks like (see https://mstdn.social/@erikarn/115986265106931691) it is not the way how the lagg interfaces should work. It is not intended to use wireless interfaces in the aggregate interfaces — so my tricky setup stopped working in the FreeBSD 15.0.

BUT, since we have a beautiful devd daemon, which listens for various system events and able to execute actions when event is happened — I just wrote 23 lines of shell script to learn my laptop how to switch between interfaces when the Ethernet cable (dis)connects, lol. Solution is very simple:

First, we already have /etc/devd/dhclient.conf, which starts dhclient when some interface appeared in the system. I modified it, so it calls the sPeCiAL script, each time when em0, or wlan0, or ue0 interface appeared in the system, or when em0 is disappeared:

notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "ethernet";
action "/root/bin/unfuck_network.tcsh $subsystem ifup";
};

notify 0 {
match "system" "IFNET";
match "type" "LINK_DOWN";
media-type "ethernet";
action "/root/bin/unfuck_network.tcsh $subsystem ifdown";
};

notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "802.11";
action "/root/bin/unfuck_network.tcsh $subsystem";
};

notify 0 {
match "system" "ETHERNET";
match "type" "IFATTACH";
match "subsystem" "ue0";
action "/root/bin/unfuck_network.tcsh ue0";
};

Then, the main magic happens in the /root/bin/unfuck_network.tcsh:
— When Ethernet cable is connected — it destroys the wlan0 interface and starts dhclient for em0 to talk with DHCP server.
— When Ethernet cable is disconnected — it makes all to remove route using em0 from routing table (removes em0 interface completely, flush routing table, etc — somehow em0 still stays in the routing table if interface is not destroyed; btw system will create it anyway later, in some point) and recreates the wlan0 interface.
— When wlan0 device is created — it starts dhclient for it.

Script contents (for tcsh):
#!/bin/tcsh

switch ( $1 )
case "em0":
if ( $2 == "ifup" ) then
service netif quietstop wlan0
service dhclient quietstart em0
else if ( $2 == "ifdown" ) then
service dhclient quietstop em0
ifconfig em0 delete
route flush
service routing restart
service netif quietstart wlan0
endif
breaksw;
case "wlan0":
service dhclient quietstart wlan0
breaksw;
case "ue0":
service dhclient quietstart ue0
breaksw;
endsw

#FreeBSD #FreeBSD150RELEASE #wifi #tcsh #devd #iwm

  • Copy link
  • Flag this post
  • Block
Stefano Marinelli boosted
Alfonso Siciliano
Alfonso Siciliano
@alfonsosiciliano@mastodon.bsd.cafe  ·  activity timestamp 3 months ago

#Lesson of the day: I waste time searching for a solution #online, then ask #AI, which gives me “wonderful” but completely wrong results. In the end, I read the official #documentation and solve it in a few seconds:

1. https://man.freebsd.org/tcsh/1 > 2. Ctrl-f > 3. type "redirect" > 4. "The shell cannot presently redirect diagnostic output without also redirecting standard output, but `(command > output-file) >& error-file' is often an acceptable workaround. ..."

#Documentation #UNIX #FreeBSD #Shell #scripting #terminal #tcsh #fixing

  • Copy link
  • Flag this post
  • Block
Alfonso Siciliano
Alfonso Siciliano
@alfonsosiciliano@mastodon.bsd.cafe  ·  activity timestamp 3 months ago

#Lesson of the day: I waste time searching for a solution #online, then ask #AI, which gives me “wonderful” but completely wrong results. In the end, I read the official #documentation and solve it in a few seconds:

1. https://man.freebsd.org/tcsh/1 > 2. Ctrl-f > 3. type "redirect" > 4. "The shell cannot presently redirect diagnostic output without also redirecting standard output, but `(command > output-file) >& error-file' is often an acceptable workaround. ..."

#Documentation #UNIX #FreeBSD #Shell #scripting #terminal #tcsh #fixing

  • Copy link
  • Flag this post
  • Block
KaiXin
KaiXin
@kaixin@snac.bsd.cafe  ·  activity timestamp 8 months ago

I just upgraded #OpenBSD from 7.1 all the way up to 7.7 one release at a time in a #KVM VM running on my laptop #Debian. At first #tcsh and #vim were giving coredumps. I realized I did not even run #pkg_add even once so I did a doas pkg_add -u. After that all is fine and everything was like before. #OpenBSD is truely awesome!

#BSD #UseBSD #RunBSD #unix #FOSS

  • Copy link
  • Flag this post
  • Block
Dendrobatus Azureus
Dendrobatus Azureus
@Dendrobatus_Azureus@mastodon.bsd.cafe  ·  activity timestamp 10 months ago

Linus Torvalds has coded git two decades ago.

Learn about why how who and where here

https://youtu.be/sCr_gb8rdEI?si=s8tDVh1e8dBTGWkJ

🖋️ #bash #sh #zsh #ksh #csh #tcsh #fish #git#Linux#POSIX#FOSS#100daysofCode#640DaysOfCode #coding#1024DaysOfCode #github #programming

The screencap showcases a VLC video player interface on an Android with a video titled "Two decades of Git: A conversation with creator Linus..." The video is currently at 4:40 out of a total duration of 41:49. The video features a man Linus Torvalds sitting in a chair, wearing a gray long-sleeve shirt with a small logo on the left side, and dark pants. He is seated in front of a large window with a view of greenery outside. There are two glasses of water on a small table to his left. The background includes a wooden wall and a large window, suggesting an indoor setting with natural light. The video player interface includes standard controls such as play, pause, and volume adjustment, along with a progress bar indicating the current playback position.

 Ovis2-8B

🌱 Energy used: 0.187 Wh
The screencap showcases a VLC video player interface on an Android with a video titled "Two decades of Git: A conversation with creator Linus..." The video is currently at 4:40 out of a total duration of 41:49. The video features a man Linus Torvalds sitting in a chair, wearing a gray long-sleeve shirt with a small logo on the left side, and dark pants. He is seated in front of a large window with a view of greenery outside. There are two glasses of water on a small table to his left. The background includes a wooden wall and a large window, suggesting an indoor setting with natural light. The video player interface includes standard controls such as play, pause, and volume adjustment, along with a progress bar indicating the current playback position. Ovis2-8B 🌱 Energy used: 0.187 Wh
The screencap showcases a VLC video player interface on an Android with a video titled "Two decades of Git: A conversation with creator Linus..." The video is currently at 4:40 out of a total duration of 41:49. The video features a man Linus Torvalds sitting in a chair, wearing a gray long-sleeve shirt with a small logo on the left side, and dark pants. He is seated in front of a large window with a view of greenery outside. There are two glasses of water on a small table to his left. The background includes a wooden wall and a large window, suggesting an indoor setting with natural light. The video player interface includes standard controls such as play, pause, and volume adjustment, along with a progress bar indicating the current playback position. Ovis2-8B 🌱 Energy used: 0.187 Wh
  • Copy link
  • Flag this post
  • Block
Dendrobatus Azureus
Dendrobatus Azureus
@Dendrobatus_Azureus@mastodon.bsd.cafe  ·  activity timestamp 10 months ago

Look at the year 2K17 yet I still used DVD storage to boot ghostBSD!

.🖋️ #bash#freeBSD#ghostBSD#BSD #sh #zsh #ksh #csh #tksh #fish #tcsh   #distro#KDE#DVD#RetroComputing #retro #storage#POSIX   #fresh #programming

The photograph shows a DVD-rw with a yellow and red 🍒 color scheme. The DVD is labeled with handwritten text. At  top, it reads "Linux MATE 2K17," and at the bottom, it says "GHOST BSD FREEBSD." The DVD is a rewritable type, as indicated by the "DVD-RW" marking. The disc also has "1.4X" and "4.7" printed on it, likely referring to the disc's speed and capacity. The DVD is encased in a clear plastic holder, and the background has a red hue, possibly from lighting. The DVD shows signs of wear, with visible scratches and scuffs.

 Ovis2-8B

🌱 Energy used: 0.186 Wh
The photograph shows a DVD-rw with a yellow and red 🍒 color scheme. The DVD is labeled with handwritten text. At top, it reads "Linux MATE 2K17," and at the bottom, it says "GHOST BSD FREEBSD." The DVD is a rewritable type, as indicated by the "DVD-RW" marking. The disc also has "1.4X" and "4.7" printed on it, likely referring to the disc's speed and capacity. The DVD is encased in a clear plastic holder, and the background has a red hue, possibly from lighting. The DVD shows signs of wear, with visible scratches and scuffs. Ovis2-8B 🌱 Energy used: 0.186 Wh
The photograph shows a DVD-rw with a yellow and red 🍒 color scheme. The DVD is labeled with handwritten text. At top, it reads "Linux MATE 2K17," and at the bottom, it says "GHOST BSD FREEBSD." The DVD is a rewritable type, as indicated by the "DVD-RW" marking. The disc also has "1.4X" and "4.7" printed on it, likely referring to the disc's speed and capacity. The DVD is encased in a clear plastic holder, and the background has a red hue, possibly from lighting. The DVD shows signs of wear, with visible scratches and scuffs. Ovis2-8B 🌱 Energy used: 0.186 Wh
  • Copy link
  • Flag this post
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.7 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct