Hi,
I have to find out the DHCPv6 server’s ip address in the network. I had gone through the lease files but could find only duid/server-id and not the IPv6 address of the dhcp server. And couldn’t find any commands to get that information. Is there a way to get the DHCPv6 server’s IPv6 address?
If I configured my machine to get an IPv4 dhcp address, I can see the lease files having the dhcp server’s address. This made me think… whether DHCP6 servers really expose their IPv6 addresses?
I would think that you configured your system to be a DHCP client. This to obtain, amongst other things, an IPv4 address (NOT an IPv4 dhcp address) from a DHCP server.
If I am correct, the Lease files are on the DHCP server (not the client) and they will have a list of MAC addresses, with the IPv4 addresses leased to them (and the TTL). They will NOT have the IPv4 address of the DHCP server.
IMHO for a DHCP server to function, it does not even need an IP address. It acts on an ethernet broadcast on the LAN. (Though it most probably will have one, because the system where the DHCP server is runing on, often a router of some sort, often needs IP connectivity for other reasons.
And as far as I am understanding IPv6 addresses, there is no need to get them from a DHCP server. They can be generated directly fom the MAC address.
The above is my understanding, which is limited, and I hope to learn from others.
First, @hcvv
Although valid IPv6 addresses can be self-generated, an IPv6 DHCP server can also be used to make Host management on the LAN easier, and possibly to also track who is on the network.
@maniC,
I don’t know what you really mean by “gone through the lease files”
I also have not personally thought to try to locate the DHCP server (both ipv4 or ipv6) from a client, although I guess maybe sometime I might have seen that reported somewhere but not thought much of that…
It’s not a problem I’ve really felt I had to address on any network I’ve managed but I guess there is always the possibility someone could set up a rogue DHCP server. There are similar apps out there that detect rogue access points which is slightly different and a likely a more common security issue…
The only way I know to find the responding DHCP server is to do a packet capture and filtering, it’s usually very easy to identify particularly if you’re using Wireshark.
@TSU
For “gone through the lease files”: I was checking the content of the dhcp lease files. For IPv4 dhcp, the lease files had the dhcp server address. So, with the same hope, was looking into the dhcp6 lease file contents. But, couldn’t find it. On one lease file I saw and entry called “server-address” and felt happy. Later realized that, that is the link local address of the dhcp client itself.
I had thought about sending a packet and determine the IP from whoever responds to it… But, was thinking whether there is any other commands or lease files…
I am using dnsmasq as a dhcp server in my tiny local network and it serves ipv6 too. In my lease files I find also only duid’s and no ipv6 addresses. But in the syslog I find some traces:
There is more than one way to serve ipv6 addresses. One works like ipv4 and serves full addresses and the other one only advertises the prefix (in my case: fd89:be49:2148:1584:: )and the clients create the full address by themselves.
And sorry, but I don’t know a way to get the ipv6 addresses of all machines in the network this way.
I forgot to mention one thing… I want to do this from code. I can run some command and parse the output or read any files. But, I shouldn’t be starting another instance of dhclient or do anything that can alter the network/device settings. Yes, my code will be run with root privileges.
IPv6 only uses static addressing - hence no lease info
on the routers used here, all info wrt addresses, IPv4 and IPv6, can be found from its web page using IPv4 addressing and listed under LAN USERS and USER LOG
default addresses being 192.168.xxx.1, where xxx is the selected network, both xxx and the 1 are variables set up by the installer / administrator
It should be obvious that you only can obtain this information if DHCP client stored it somehow. So at the least you need to tell what DHCP client you are using.
If I configured my machine to get an IPv4 dhcp address, I can see the lease files having the dhcp server’s address.
It is not DHCP server address. It is value of “sname” field in DHCP packet which is rather vaguely defined. Based on later clause in TFTP server name option “This option is used to identify a TFTP server when the ‘sname’ field in the DHCP header has been used for DHCP options” it appears to be intended as TFTP server name. Which often is the same as DHCP server but not necessary.
AFAIK
The only DHCP v6 configuration I think that’s applicable here is to store and serve full IPv6 addresses… and therefor leases should be listed on the DHCP v6 server somewhere.
When a DHCP v6 server serves only prefixes, those prefixes are only assigned to routers (not non-router Hosts), and then the Hosts behind the router would use the Neighbor Discovery Protocol to discover the assigned prefix and self-generate their own IPv6 addresses.
I haven’t looked closely at setting up a DHCP v6 server on openSUSE and would be curious if the yast2-dhcp-server module supports configuring Ipv6 addresses… So, I can’t yet say how the openSUSE DHCP v6 server works for sure and how to configure… But, am pretty sure that there has to be a location storing full IPv6 assigned leases and would be enormously surprised if things are different than expected.
Until now we assumed that you have chosen OTHER VERSION as prefix of the thread title, to indicate that you use several different openSUSE systems. But now you admit that this is not about openSUSE at all :(.
Current version of wicked puts IPv6 DHCP server address as SERVERADDR variable in leaseinfo file (/run/wicked/leasinfo.interface). Do not know if SLES12 already had it. This was added in 2014 so chances are at least SLES12 SP2 (a.k.a. Leap 42.2) has it.
That maybe true (well, in general a distribution can adapt a product to it’s whym), but in general people on the openSUSE forums expect that the discussions/question/problems are about openSUSE. Some may feel cheated when that is not the case and kept as a secret.
My dhcp server is a Raspberry Pi 1B with Raspbian und dnsmasq. My client is a laptop with openSUSE Tumbleweed and NetworkManager.
My ip addresses:
4: wlp6s5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:13:ce:f2:6a:35 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.102/24 brd 192.168.0.255 scope global dynamic wlp6s5
valid_lft 85542sec preferred_lft 85542sec
inet6 fd89:be49:2148:1584::1e2/128 scope global dynamic
valid_lft 42346sec preferred_lft 42346sec
inet6 fd89:be49:2148:1584:51d1:9b00:17d4:5828/64 scope global temporary dynamic
valid_lft 42862sec preferred_lft 42862sec
inet6 fd89:be49:2148:1584:ce63:bc68:ee:30a4/64 scope global mngtmpaddr noprefixroute dynamic
valid_lft 42862sec preferred_lft 42862sec
inet6 fe80::b58e:ca27:11d8:cb47/64 scope link
valid_lft forever preferred_lft forever
“inet6 fd89:be49:2148:1584::1e2/128 scope global dynamic” is the full ipv6 address served by dnsmasq
The other two starting with “fd89:be49:2148:1584:” are dynamically created by the client from this advertised prefix.
As you see I use both methods in my setup.
Inspired by this post I experimented with my setup until I managed to “convince” dhclient to send the hostname (send fqdn.fqdn) to the dhcp server even for ipv6. Now I see the lease, address and hostname in the lease file on the server. But I had to tweak the settings manually in /etc/dhclient6.conf. I didn’t find a GUI for this neither in YaST nor in NetworkManager.
Hendrik