Jump to content

30-sysinfo get_ip_addresses()


piknew

Recommended Posts

Is it possible to make small adjustment into line 109 of /etc/update-motd.d/30-sysinfo file (I made the change myslef, but once packages are upgraded - change is overwritten)? Original line is:

 

if [[ $intf =~ ^[ewr].* ]]; then

 

Changed line would be (please note additional letter "b"):

 

if [[ $intf =~ ^[ewrb].* ]]; then

 

You may see the reason - I guess "bond" is the common prefix when binding ethernet devices:

 

admin@PKSERVER:~$ grep -n ewr /etc/update-motd.d/30-sysinfo
109:            if [[ $intf =~ ^[ewrb].* ]]; then
admin@PKSERVER:~$ sudo ifconfig
bond0     Link encap:Ethernet  HWaddr 08:00:00:00:02:10
          inet addr:192.168.10.210  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:ff:fe00:210/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:171152 errors:0 dropped:0 overruns:0 frame:0
          TX packets:163786 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:59535359 (56.7 MiB)  TX bytes:90682136 (86.4 MiB)

eth0      Link encap:Ethernet  HWaddr 08:00:00:00:02:10
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:171152 errors:0 dropped:0 overruns:0 frame:0
          TX packets:163786 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:59535359 (56.7 MiB)  TX bytes:90682136 (86.4 MiB)
          Interrupt:114

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:90328 errors:0 dropped:0 overruns:0 frame:0
          TX packets:90328 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:43909407 (41.8 MiB)  TX bytes:43909407 (41.8 MiB)

wlan0     Link encap:Ethernet  HWaddr da:f9:d4:00:43:7b
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

Link to comment
Share on other sites

On 5/19/2018 at 4:39 PM, piknew said:

... Or explicit list of interfaces. 

 

 

Proposal:

 

root@PKSERVER:~# grep -n ewr /etc/update-motd.d/30-sysinfo
109:            if [[ $intf =~ ^[ewr].* ]] || (grep $intf /etc/conf.d/30-sysinfo-net-interfaces 1>/dev/null 2>&1); then
root@PKSERVER:~# cat /etc/conf.d/30-sysinfo-net-interfaces
bond0
root@PKSERVER:~#

 

Link to comment
Share on other sites

 

On 5/15/2018 at 6:00 PM, zador.blood.stained said:

This will also include bridge interfaces which are usually named brX, so this regexp may need further rework.

 

During some experiments with nightly builds I noticed that script 30-sysinfo was updated. However, with additional regexp |^br.* - which will include bridges. Maybe I misunderstood, but I thought br interfaces shall be rather excluded, bond included, shall not they?

 

So far I keep modified copy of script (from "proposal" above) and I am using it after it is overwritten by "upgrade".

Link to comment
Share on other sites

27 minutes ago, vlad59 said:

I agree br should be excluded (at least for my usecase which involve docker).


In the end, we should make this configurable.

Link to comment
Share on other sites

2 hours ago, Igor said:


In the end, we should make this configurable.

 

Yes .... but something configurable is often more complex to maintain so while motd is kind of important for a guy that installed Armbian for the first time, it's rarely useful for someone that only use SSH with a purpose in mind (I only give a quick look to system load to check for unusual load that's all). It depends on the goal.

 

 

 

Link to comment
Share on other sites

On 5/31/2018 at 10:22 AM, Igor said:

 

Thanks. I have tested it with custom entry:

SHOW_IP_PATTERN="^[ewr].*|^br.*|^lt.*|^umts.*|^bond.*"

Test is successful on:

  • Orange Pi+ 2E
  • Orange Pi+ 2
  • Orange Pi PC
  • Orange Pi Zero (H2+/512)

My config for network is to make binding for network interfaces, so bond0 interface is the valid one.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines