Hot answers tagged

25

1) You shouldn't manually update your resolv.conf, because all changes will be overwritten by data that your local DHCP server provides. If you want it to be static, run sudo dpkg-reconfigure resolvconf and answer "no" to dynamic updates. If you want to add new entries there, edit /etc/resolvconf/resolv.conf.d/base and run sudo resolvconf -u, it will append ...


23

VirtualBox DHCP is working properly. There is nothing wrong with having all of your machines getting the same address in NAT configuration. All VMs are isolated from each other so there is no risk of conflict. They are also not on the same adapter. Each VM has its own virtualized hardware including NICs. The default gateway also need not to be 10.0.2.1. ...


23

If your dhcp is properly configured to give you an IP address, the command: dhclient eth0 -v should work. The option -v enable verbose log messages, it can be useful. If your eth0 is already up, before asking for a new IP address, try to deconfigure eth0. To configure the network interfaces based on interface definitions in the file /etc/network/...


21

No, you can only get this information server side from the DHCP server. This information is contained in the DHCP server's .lease file: /var/lib/dhcpd/dhcpd.leases, if you're using ISC's DHCP server. Example $ more /var/lib/dhcpd/dhcpd.leases # All times in this file are in UTC (GMT), not your local timezone. This is # not a bug, so please don't ask ...


21

isc-dhcpd package version 4.3.1 has this command to list leases: dhcp-lease-list --lease PATH_TO_LEASE_FILE This is a simple perl script script that also supports older DHCP releases. You can see a copy in the Debian source code or in the official DHCP distribution (in contrib/) as well. The output is pretty: $ perl contrib/dhcp-lease-list.pl --lease /...


20

You can add the following line to /etc/dhcp/dhclient.conf: prepend domain-name-servers <working DNS IP(s) here>; This adds the DNS IP address(es) you specify before that/those provided by the DHCP. If you would like to add it/them after the address(es) provided by the DHCP, just use append domain-name-servers <working DNS IP(s) here>; If, ...


19

Right click on the Network Manager icon on Ubuntu top panel and select edit. Go to Wired Network or Wireless Network tab and select the network name. Click on the edit button and go to IPv4 settings tab on the new window. If the method is Automatic (DHCP) you are using dhcp. Other method is cat /var/log/syslog and check for some thing like below ...


19

The original DHCP specification (RFC 2131 and 2132) defines an option (33) that allows the administrator of the DHCP service to issue static routes to the client if needed. Unfortunately, that original design is flawed these days as it assumes classful network addresses, which is rarely used. The rfc3442-classless-static-routes option allows you to use ...


18

Some DHCP servers send out host names. Clients can accept or ignore such offers. Have a look at your local /etc/dhcp/dhclient.conf file to inspect your current configuration. There is a list of request entities one of which will probably readhost-name. For more information check out the man page of dhclient.conf.


16

Put only 127.0.0.1 as a name server in /etc/resolv.conf, and run a DNS cache locally. I recommend Dnsmasq, it's lightweight and easy to setup. On distributions such as Debian and Ubuntu, I also recommend installing the resolvconf package, which takes care of maintaining /etc/resolv.conf when you aren't running a local DNS cache, or of maintaining the DNS ...


16

If you specify allow-hotplug eth0 instead of auto eth0 in /etc/network/interfaces, then the connection will only be initiated by udev when something triggers it, instead of at every boot. That might be sufficient to handle your case, but not necessarily; the interfaces manpage mentions that (Interfaces marked "allow-hotplug" are brought up when udev ...


15

This is needed if you are using DHCP v6 due to the slightly different way that DHCP works in v4 and v6. In DHCP v4 the client establishes the connection with the server and because of the default rules to allow 'established' connections back through the firewall, the returning DHCP response is allowed through. However, in DHCP v6, the initial client ...


15

Somehow, my firmware got trouble with long interface name. So I ran this command to prevent it: ln -s /dev/null /etc/systemd/network/99-default.link and it worked.


15

systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both. To fix, replace the contents of one or both of /etc/machine-id. ...


14

Okay, can I get a "D'oh!" from the congregation! In RHEL6 and derivatives, the dhcpd config file is now located at /etc/dhcp/dhcpd.conf, not /etc/dhcpd.conf. Moved the file and all is well.


13

dnsmasq is simpler and because of that has less features. But if you don't need anything fancy and since you were already able to set it up, you probably don't need them. Dnsmasq is designed for small, local networks. You can read on its site that by small networks, they mean up to 1000 computers so it's not that bad. So my answer is: there is absolutely ...


13

You can provide static IP by editing the file /etc/sysconfig/network-scripts/ifcfg-eth0 as root user in Redhat. It should look like this: DEVICE=eth0 BOOTPROTO=STATIC IPADDR=192.168.0.5 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 ONBOOT=yes After saving this file. You need to restart the network daemon using following command. $ sudo /etc/init.d/network ...


12

In your /etc/sysconfig/network file, add: DOMAIN=example.com or DOMAIN="example.com sub.example.com" Settings in the file /etc/sysconfig/network apply to all network interfaces. Since all interfaces are usually part of the same domain, it is best to place the DOMAIN or SEARCH setting in this file. In the unusual case that the system has multiple ...


11

systemctl enable dhcpcd.service works for me.


11

Either dhclient -r && dhclient or dhclient -r eth0 eth1 && dhclient eth0 eth1 Edit 1: Next try: You can probably get rid of the "dhclient(22421) is already running - exiting" error by making one of the instances use different files. Use PATH_DHCLIENT_PID and PATH_DHCLIENT_DB variables (or the eqivalent command line options, see the man ...


11

You can accomplish this with the following awk command: nmap -sP 192.168.3.0/24 \ | awk '/192.168.3/ && !/192.168.3.1$/{print $NF}' This is telling awk to print the last field of the matched line(s)


10

A trick I'll often use is to take a look at the output of this command, here I'm running it on CentOS 6, but it should still be applicable to you on RHEL as well: $ ps -eaf | grep dhcli root 1044 1 0 Jan17 ? 00:00:00 /sbin/dhclient -1 -q -cf /etc/dhcp/dhclient-eth0.conf -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0....


10

The best way to guarantee the same IP at all times for a given host is to set up a MAC Address IP reservation in the DHCP server. Get the MAC address if your laptop, then go to your DHCP server, and assign a specific IP address to be issued to a host requesting from that MAC address.


10

The dhclient that NetworkManager calls should be the same irregardless. On my Fedora 19 system I'm getting the following command run via NetworkManager when I allow it to connect: /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-client.action \ -pf /var/run/dhclient-wlp3s0.pid \ -lf /var/lib/NetworkManager/dhclient-5117671a-6bc3-...


10

If the dhcp server you are using is configured to provide the ntp-servers option, you can configure your dhclient to request ntp-servers by adding ntp-servers to the default request line in dhclient.conf, as shown at the end of this example from Ubuntu Linux (as of 19.04, but present since at least 12.04): request subnet-mask, broadcast-address, time-offset,...


8

Since dhcpd has to hand out IP addresses to clients, it needs to know the range of addresses that it is responsible for. The subnet declaration gives dhcpd that information and more. Assuming you're using 10.0.0/24, the following should get you started and past the error message, but you really need to get into the documentation to go further. Add this to ...


8

I'm using debian but directories should be the same or similar. Check if you have the directory /var/lib/dhcp. Then: ls -lrt /var/lib/dhcp/ You should see files named /var/lib/dhcp/dhclient-random-numbers-eth1.lease. Look for the most recent file associated with the interface you're interested in and open it up: cat /var/lib/dhcp/dhclient-...-eth1.lease ...


8

egrep command can be used to get an output: egrep "lease|hostname|hardware|\}" /var/lib/dhcpd/dhcpd.leases Output: lease 192.168.11.10 { hardware ethernet 20:6a:8a:55:19:0a; client-hostname "Maryam-PC"; } lease 192.168.11.7 { hardware ethernet 00:16:ea:51:d3:12; client-hostname "parsoon"; } lease 192.168.11.3 { hardware ethernet 00:17:c4:3f:84:...


8

Mint and other modern distros ship with mdns by default, which wraps the regular public DNS with a local "decentralized" wrapper which enables zeroconf support for your local network. Basically, a local DNS server resolves names in the local network it has discovered, then falls back to the (now proxied) public DNS for public Internet resolution, i.e. for ...


8

There's no need to scan the entire subnet if you know that you're not interested in part of it. (Avoiding the computer means you don't need to discard its result.) nmap -oG - -sn 192.168.3.2-254 | awk '$NF=="Up" {print $2}' or if you prefer using the XML output instead of the grep output nmap -oX - -sP 192.168.3.2-254 | xmlstarlet sel -t -m '//address[@...


Only top voted, non community-wiki answers of a minimum length are eligible