Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 8643  / 2 Years ago, sat, march 26, 2022, 4:55:26

i assigned a temporary ip address to my eth0 interface using this command



sudo ifconfig eth0 169.254.1.1 netmask 255.255.0.0



as described here



it works fine, when i do ifconfig it shows the newly assigned ip address.



eth0      Link encap:Ethernet  HWaddr 5c:26:0a:4f:32:11  
inet addr:169.254.1.1 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::5e26:aff:fe4f:3211/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:774 errors:0 dropped:0 overruns:0 frame:0
TX packets:1160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:170598 (170.5 KB) TX bytes:218967 (218.9 KB)
Interrupt:20 Memory:f6900000-f6920000


i expected this ip address should hold until i flush it out. but soon afterwards it is reset



eth0      Link encap:Ethernet  HWaddr 5c:26:0a:4f:32:11  
inet6 addr: fe80::5e26:aff:fe4f:3211/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:784 errors:0 dropped:0 overruns:0 frame:0
TX packets:1202 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:174678 (174.6 KB) TX bytes:228013 (228.0 KB)
Interrupt:20 Memory:f6900000-f6920000


i only need this ip address temporarily and rather not change my /etc/network/interfaces which reads



auto lo
iface lo inet loopback


i am on 12.04, any suggestion would be helpful
thanks



UPDATE



this is my motive. i want to transfer some large files over ethernet. I have laptops with Gigabit capable adapters but slow routers. When both machines are windows i can simply hook them up with a network cable and after some time when they dont find a dhcp server they revert to link-local address of range 169.254.x.x/16 and file transfers would just work. Unfortunately in Ubuntu this does not happen. I have to manually set an ip address. Then the machines can ping each other and can transfer files, but only for a short interval of time.



One thing I can do is keep issuing sudo ifconfig eth0 ... every 30 secs or so to keep things working but this is pretty annoying. I have to do this kind of transfers quite frequently so would rather not take the hassle of modifying etc/network/interfaces everytime.


More From » 12.04

 Answers
7

Following @Jobin's answer I made a discovery that was easier.



In Network management under wired connection tab -> IPv4 settings, you can change method to Link Local (from Automatic DHCP). for a quick file sharing session, this is easier as you dont have to enter a manual IP address everytime.


[#27636] Sunday, March 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
avilyexplor

Total Points: 20
Total Questions: 102
Total Answers: 120

Location: Maldives
Member since Mon, Jun 21, 2021
3 Years ago
;