:: Re: [DNG] simple-netaid-gtk -- vers…
Etusivu
Poista viesti
Vastaa
Lähettäjä: tito
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] simple-netaid-gtk -- versions? dhcp? unbound?
On Tue, 30 Apr 2024 19:42:06 +0200
al3xu5 via Dng <dng@???> wrote:

> Hi aitor
>
>
> Tue, 30 Apr 2024 02:12:59 +0200 - aitor <aitor_czr@???>:
>
> > > Nice... but... How should be the content of /etc/network/interfaces?
> >
> > It's suggested in the README.md of libnetaid. Something like this will work:
> >
> > iface eth0 inet dhcp
> > iface wlan0 inet dhcp


Maybe set it to manual
and start the dhcpd in client mode on interface up
(the example is for isc-dhcp so you have to work out your own
commandline):

iface eth1 inet manual
        pre-up /sbin/ip link set $IFACE up
        up /sbin/dhclient -nw -4 -v -i -pf /run/dhclient.$IFACE.pid -lf /var/lib/dhcp/dhclient.$IFACE.leases -I -df /var/lib/dhclient6.$IFACE.leases $IFACE
        pre-down /sbin/dhclient -r -4 -v -i -pf /run/dhclient.$IFACE.pid -lf /var/lib/dhcp/dhclient.$IFACE.leases -I -df /var/lib/dhclient6.$IFACE.leases $IFACE
        down /sbin/ip link set $IFACE down


Hope this helps.
Ciao,
Tito

> >
> > It's up to you to add other stanzas like allow-hotplug, auto, etc.
> >
> >
> > > I have some problems here (I suppose probably related to ifdown).
> > >
> > > What if I want /etc/network/interfaces define only the loopback interface
> > > (this, for example, to handle dhcp for eth0 directly by dhcpcd)?
> >
> > If you only add stanzas for the loopback interface "lo", ifupdown will do
> > nothing.
>
> Yes... I had /etc/network/interfaces with:
>
> auto eth0
> allow-hotplug eth0
> iface eth0 inet dhcp
>
> But dhcpcd refuse to start with this error:
>
> Not running dhcpcd because /etc/network/interfaces ... failed!
> defines some interfaces that will use a DHCP client ... failed!
>
> So I have this problem: if /etc/network/interfaces is empty (without eth0)
> then dhcpcd works, and if I set `iface eth0 inet dhcp` then dhcpcd doesn't
> start and simple-netaid (ifdown) cannot manage the eth0 interface...
>
> I wouldn't know how to handle it...
>
> Maybe I should disable the dhcpcd service? What else?
>
>
> > > Simple-netaid-gtk says 'Connected to eth0', but I cannot bring down eth0
> > > (the message is: 'ifdown: unknown interface eth0)...
> >
> > Exactly. This is because you only have the loopback interface in your
> > /etc/network/interfaces
>
> Indeed (see above)...
>
> > > and running:
> > > $ sudo ubus call ering.netaid ifdown '{ "ifname": "eth0" , "tty": 2 }'
> > > apparently do noting (eth0 say up)...
> >
> > For the same reason. On the other hand, using sudo in the ubus calls makes
> > no sense because they provide granted privileges without the need of root
> > permissions, just as dbus does.
> >
> > If you are root, run commands like:
> >
> > # ip link set eth0 up
> > # ifup eth0
> >
> > However, if you aren't root then you want to run commands like:
> >
> > $ ubus call ering.netaid interface_up '{ "ifname": "eth0"}'
> > $ ubus call ering.netaid ifup '{ "ifname": "eth0"}'
>
> Oh yes of course... I didn't know what else to invent... :)
>
>
> > The variable "tty" is optional. I use it to redirect the output to the vte
> > terminal of the GUI.
> >
> >
> > > Maybe bringing interfaces up/down with the more portable ifconfig
> > > (ifconfig <interface> up|down) instead of ifup ifdown could be a
> > > solution?
> >
> > It might be another option, although I think ifconfig is deprecated.
>
> You are right. A better option could be `ip`, which sould provide:
> ip link set <interface> down
> ip link set <interface> up
>
> Thank you a lot
>
> alexus
>
>