ostridge
Posts: 8
Joined: Wed Sep 18, 2013 10:05 am

Jessie Network config QUESTION

Sat May 28, 2016 3:50 pm

I have loaded incrediblepbx13-raspbian8 image onto my Rpi2 from the following source

https://sourceforge.net/projects/pbxina ... p/download

Code: Select all

uname -a
Linux pi2b 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv71 GNU/Linux
The image was installed to SD card using my first RPi2 with Raspbian7 and with network configured manually in /etc/hostname /etc/hosts /etc/resolv.conf and /etc/network/interfaces .
On booting the new image grabs the same IP as my first Pi2 and manually entered network config gets overwritten presumably by resolvconf .

My question is how do I change the /etc/hostname to pi2b and /etc/hosts /etc/resolv.conf and /etc/network/interfaces such that it won't try to be pi2 (1st pi), and so it gets correctly configured.

Code: Select all

dpkg-query -l 'isc*' 
ii      isc-dhcp-client                 4.2.2dfsg.1-5+deb70u6          armhf      ISC DHCP client
ii      isc-dhcp-common           4.2.2dfsg.1-5+deb70u6          armhf      common files used by all the isc-dhcp* packages 

dpkg-query -l 'resolvconf'
rc    resolvconf                        1.67                                            all            name server information handler 

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Jessie Network config QUESTION

Sat May 28, 2016 4:20 pm

No sure where the question is. You edit the files on the new machine exactly the same way you did with the previous one, not?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

ostridge
Posts: 8
Joined: Wed Sep 18, 2013 10:05 am

Re: Jessie Network config QUESTION

Sat May 28, 2016 5:01 pm

epoch1970 wrote:No sure where the question is. You edit the files on the new machine exactly the same way you did with the previous one, not?
Ye thats what I thought BUT in fact resolvconf overwrites the config on startup - so editing the manual method doesnot work.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Jessie Network config QUESTION

Sat May 28, 2016 6:01 pm

Ah I see. You have an issue with "dhcpcd" then.
Look around for "dhcpcd static ip" you'll find a few threads (some angry...)

The way I solved it was to apt-get remove --purge dhcpcd, and only use /etc/network/interfaces.
But I am a luddite. Don't be like me ;)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

ostridge
Posts: 8
Joined: Wed Sep 18, 2013 10:05 am

Re: Jessie Network config QUESTION

Sat May 28, 2016 7:06 pm

Code: Select all

dpkg-query -l 'dhcp*'
un     dhcp3-client        <none>      
un     dhcp3-common        <none>
un     dhcpcd       <none>
No as shown above - that seems to be not installed.

I think it must be the isc-dhcp-client
removing is a probably a good workaround but I was thinking a correct solution would be todo with the config for isc-dhcp-client or resolvconf or something? It must be some bug if the pi2b is grabbing an IP thet actually already belongs to pi2 and it then changes the hostname back so that there are 2x pi2 responding to same ssh headless session its pot luck which answers, and then the ssh session disconnects.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Jessie Network config QUESTION

Sat May 28, 2016 8:47 pm

Well aren't you using static IP assignment in /etc/network/interfaces?
That could explain the ip conflict, and there is a wonkiness with dhcpcd and static addresses, reverting to dhcp or something.

Anyways. You can cleanup part of the setup. /etc/hostame: use a different hostname for each. (Should not matter, except dhcp clients like sending the hostname to the servers)
/etc/resolv.conf: this one is either updated by the dhcp client, or set within /etc/network/interfaces (God knows what dhcpdc makes of it) -- basically, you shouldn't need edit it. Or you could empty it and see if it gets regenerated ok.
/etc/hosts: I would leave it almost empty, with declarations for the local host, and declarations for a few key external machines that could be looked up by name very early at boot time
/etc/network/interfaces: if you're using fixed ip addresses (iface blah0 inet static), make sure the Ip addresses are unique to each Pi, and all the rest the same (network, gateway, etc.) Also make sure you're not setting the MAC address of interfaces, and if you are, make each MAC different.
If you had modified the standard dhcp client setup (/etc/dhcp/dhclient.conf, look also perhaps for a dhcp5 conf), check there isn't a static "hostname=<the wrong pi>" lurking in there.
In case you're using zeroconf, i.e. avahi-deamon, check that /etc/avahi/avahi-deamon.conf does not declare a hostname.

I can't think of anything else that would lead to confusing the 2 machines...

Ah yes. Last ditch effort, look into /etc/udev/rules.d/ an see if there isn't some custom rule in there that does something funny.
Last edited by epoch1970 on Sat May 28, 2016 9:11 pm, edited 2 times in total.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Jessie Network config QUESTION

Sat May 28, 2016 9:08 pm

Is this on the same physical Pi (I'm not sure if you're trying to run a single Pi with a new image or different Pis). If it's two Pi's it's not clear which Pi your editing files on.

DHCP servers will give out addresses based on the client identifier, this is often the system mac address, So if it's the same Pi with a different image you're likely to get the same IP each time as the mac-address is the same.

For changing the hostname you should just need to edit /etc/hostname and /etc/hosts on the Pi who's name you need to change. Nothing to overwrite those files. /etc/hostname sets the system name and /etc/hosts provides a local IP <-> name mapping (similar to what dns does but only for the local host)

You should only need to touch /etc/dhcpcd.conf (or /etc/network/interfaces if dhcpcd is removed) if you want to set a static IP and /etc/resolv.conf if you want to change dns servers (if resolvconf is in use you can configure the name servers and search in /etc/network/interfaces and probably also via dhcpcd.conf)

ostridge
Posts: 8
Joined: Wed Sep 18, 2013 10:05 am

Re: Jessie Network config QUESTION

Sun May 29, 2016 1:40 am

The problem would not exist if both SD card images had been on same HW. - Ok that was 2x RPi2b hardware & different MAC addresses as shown:

Code: Select all

 
pi2       HWaddr  =   *:13:ec        Image = Raspbian 7 Wheezy                                       Static IP 
pi2b     HWaddr  =   *:24:78       Image = Raspbian 8 Jessie (3.18.11-v7+ #781 ...)   = editing on this one
Wheezy is live but small pbx, and pi2b is still to configure.
I have to thank you epoch1970 and mfa298 both for the thoughtful replies, and your time.
I need to work through this when time permits; but for now time for sleep.

Return to “Troubleshooting”