odroid u3 and static ip with multiple aliases

Ask questions about Arch Linux ARM. Please search before making a new topic.

odroid u3 and static ip with multiple aliases

Postby butch » Fri Sep 05, 2014 8:14 pm

Hi,

I am running archlinux on a odroid u3. I am using archlinux image for u2 which has been updated by pacman.

I want to give the nic eth0 two IPs in two different networks, so that it can work plug and play in both networks - depending on the LAN cable I plug in.

But I do not understand how to config one or more static IPs.

I changed /etc/netctl/eth0 to following (First I try to get one static IP running):

Description='A basic dhcp ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.178.2/24')
Gateway=('192.168.178.1')
DNS=('192.168.178.1')
## for DHCPv6
#IP6=dhcp
## for IPv6 autoconfiguration
#IP6=stateless
ExecUpPost='/usr/bin/ntpd -gq || true'

But when I boot the odroid it still gets it's IP via DHCP.

Is it the wrong config file?

Could anyone explain the relation of ifplugd and netctl?

Thanks,
butch
butch
 
Posts: 7
Joined: Fri Sep 05, 2014 8:02 pm

Re: odroid u3 and static ip with multiple aliases

Postby pepedog » Sun Sep 07, 2014 8:00 am

The service was enabled with
systemctl enable netctl-ifplugd@eth0
The tacked on eth0 means look thru all files in /etc/netctl/, find out if Interface=eth0, and act upon it.
The filename eth0 is coincidental.

See if address is got via another method also, ie systemctl-networkd or dhcpcd
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: odroid u3 and static ip with multiple aliases

Postby butch » Sun Sep 07, 2014 1:46 pm

Thanks for your reply. I am a bit further.

I modified /etc/netctl/eth0

If the dhcp server is up during starting the odroid, I get an IP by the dhcp server, not the one of the eth0 profile.

But if the decp server is down during starting the odroid, I get these IPs wich are defined in eth0 profile of netctl.

I found a deployed script of ifplugd, which seems to cause the "trouble": /etc/ifplugd/netctl.action
That's the content:
$this->bbcode_second_pass_code('', '#!/bin/bash
#
# ifplugd.action script for netctl

. /usr/lib/network/globals

PROFILE_FILE="$STATE_DIR/ifplugd_$1.profile"

case "$2" in
up)
# Look for a dhcp based profile to try first
# dhcp can actually outright fail, whereas
# it's difficult to tell if static succeeded
# Also check profile is same iface and is right connection
echo "up"
declare -a preferred_profiles
declare -a dhcp_profiles
declare -a static_profiles
while read -r profile; do
(
echo "Reading profile '$profile'"
source "$PROFILE_DIR/$profile"
[[ "$Interface" == "$1" && "$Connection" == "ethernet" ]] || continue
is_yes "${AutoWired:-no}" && exit 1 # user preferred AUTO profile
[[ "$IP" == "dhcp" ]] && exit 2 # dhcp profile
exit 3 # static profile
)
case $? in
1) preferred_profiles+=("$profile");;
2) dhcp_profiles+=("$profile");;
3) static_profiles+=("$profile");;
esac
done < <(list_profiles)
if [[ ${#preferred_profiles[@]} > 1 ]]; then
echo "AutoWired flag for '$1' set in more than one profile (${preferred_profiles[*]})"
fi
for profile in "${preferred_profiles[@]}" "${dhcp_profiles[@]}" "${static_profiles[@]}"; do
if ForceConnect=yes "$SUBR_DIR/network" start "$profile"; then
mkdir -p "$(dirname "$PROFILE_FILE")"
printf "%s" "$profile" > "$PROFILE_FILE"
exit 0
fi
done
;;
down)
if [[ -e "$PROFILE_FILE" ]]; then
if ForceConnect=yes "$SUBR_DIR/network" stop "$(< "$PROFILE_FILE")"; then
rm -f "$PROFILE_FILE"
exit 0
fi
fi
;;
*)
echo "Wrong arguments" >&2
;;
esac

exit 1


# vim: ft=sh ts=4 et sw=4:
')

Unfortunately I do not understand the script - except for the comments.
As I understand the comments, It is using dhcp, only if it fails it is using the eth0 profile.

What do I need to change that allways the eth0 profile is used?

thanks, butch
butch
 
Posts: 7
Joined: Fri Sep 05, 2014 8:02 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 2 guests

cron