0

I can't change the default ip address of my linux box. I tried

dhcpcd -k

I got a dhcpcd: command not found

I tried to do a:

install dhcpcd

but I can't install dhcpcd because I don't have internet at the moment. The device I'm working with starts with a default static IP.

I also tried

dhclient eth1 -v

I get Internet Systems Consortium DHCP Client 4.3.5 Copyright 2004-2016 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/00:90:e8:00:f9:d7
Sending on   LPF/eth1/00:90:e8:00:f9:d7
Sending on   Socket/fallback
DHCPREQUEST of 10.13.2.109 on eth1 to 255.255.255.255 port 67
DHCPACK of 10.13.2.109 from 10.13.1.1
RTNETLINK answers: File exists
bound to 10.13.2.109 -- renewal in 42817 seconds.

I type in {ifconfig}

and I still get:

    eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.4.127  netmask 255.255.255.0  broadcast 192.168.4.255
    inet6 fe80::290:e8ff:fe00:f9d7  prefixlen 64  scopeid 0x20<link>
    ether 00:90:e8:00:f9:d7  txqueuelen 1000  (Ethernet)
    RX packets 134834  bytes 17025152 (16.2 MiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 2265  bytes 140834 (137.5 KiB)

How do I install dhcp if I have no internet?

PSsst...I'm a newb when it comes to linux.

I'm on debian 9.0 btw.

Edit

If I type in ip addr I get

 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  link/ether 00:90:e8:00:f9:d7 brd ff:ff:ff:ff:ff:ff
  inet 192.168.4.127/24 brd 192.168.4.255 scope global eth1
     valid_lft forever preferred_lft forever
  inet 10.13.2.109/22 brd 10.13.3.255 scope global eth1
     valid_lft forever preferred_lft forever
  inet6 fe80::290:e8ff:fe00:f9d7/64 scope link
     valid_lft forever preferred_lft forever

I see where it says inet 10.13.2.109. I guess what's throwing me off is it also states my inet is 192.168.4.127. ELI5?

4
  • 1
    It might help to specify which version of which distro (Linux distribution) you're running. Some of the instructions vary between distros and even versions of the same distro. For example, Ubuntu 14.04 used ifupdown and /etc/network/interfaces, whereas Ubuntu 18.04 uses netplan and /etc/netplan/01-netcfg.yml
    – Spiff
    Commented Jun 17, 2019 at 20:32
  • I'm on debian 9.0. I also tried
    – Traderjoe
    Commented Jun 17, 2019 at 20:33
  • 2
    But you show in your post that you already have a DHCP client. That's what dhclient is, and when you run it, it is even reporting that it has successfully obtained a lease (for address 10.13.2.109). Commented Jun 17, 2019 at 21:21
  • Ooops. I later typed in ifconfig and I get [code] eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.4.127 netmask 255.255.255.0 broadcast 192.168.4.255 inet6 fe80::290:e8ff:fe00:f9d7 prefixlen 64 scopeid 0x20<link> ether 00:90:e8:00:f9:d7 txqueuelen 1000 (Ethernet) RX packets 134834 bytes 17025152 (16.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2265 bytes 140834 (137.5 KiB) [/code]
    – Traderjoe
    Commented Jun 18, 2019 at 12:38

1 Answer 1

0

DHCP consists of a server and a client.

The client is the one that gives your machine its "default" IP address - basically it broadcasts into the subnet "Hello! I am new here, can someone please give me an IP address?" and then the server answers "Welcome to this subnet, here's your IP address and other routing information". The server typically runs e.g. on your home router.

So you already have dhclient, no need to install anything, and running it shows everything works, it's giving you the IP address 10.13.2.109 as told by the server.

If you now look at your network interfaces with ip addr, you should see the network interface eth1 (the one that you connected) with that address.

If your real problem is "but I can't connect to the internet" as in "my web browser doesn't work", please edit the question and specify what exactly you did, and what exactly doesn't work, and what the error messages are.

Edit

(Please don't edit my answer with new information, edit your question instead).

If your problem is that you somehow got two IP addresses, then the next step is to find out how that happened. Look into the syslog (use journalctl if you are using systemd) or in dmesg for any hints, like two log entries of dhclient.

If the problem is that you also have configure a static IP address somewhere, remove the static IP address.

You can also experiment and remove first one address and then the other with ip addr del 192.168.4.127/24 dev eth1 or ip addr del 10.13.2.109/22 dev eth1 and see if you get a working configuration this way. You can re-add the IP address by executing dhclient again, or using ip addr add ....

A configuration with two IP addresses on the same network interface is usually an error, and would explain why you can't get internet.

Test with something like ping 8.8.8.8 which doesn't require name resolution (DNS) to work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .