Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 9393  / 3 Years ago, tue, may 25, 2021, 11:25:37

I have two Ubuntu PCs whose network cards connected directly to each other with cross-over cable. I have assigned ip addresses manually to their interfaces using command similar to



 ifconfig eth0 192.168.2.1 up


The problem is that every time I physically disconnect those PCs, the connection goes down and next time when I connect it back, the IP addresses are lost. Also whatever applications I have bound to those addresses before disconnect needs restarting two.
Is there a way to keep network interfaces UP during physical cable disconnect so the apps which create listening sockets on those addresses, would not need to be restarted after re-connect?


More From » networking

 Answers
0

Edit your /etc/networking/interfaces and add:



iface eth0 inet static
address 192.168.2.1
netmask 255.255.255.0


Then eth0 has static ip always.



More info on configuring interfaces with man interfaces



You can also use Network Connections graphical setup tool from your system preferences. You can configure network-manager to use static ip-addresses from there.


[#44484] Tuesday, May 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ongdiligenc

Total Points: 452
Total Questions: 111
Total Answers: 107

Location: Ukraine
Member since Sun, Dec 13, 2020
3 Years ago
;