# Customizing dhcp client hostname in network-manager

**URL:** <https://linux-tips.com/t/customizing-dhcp-client-hostname-in-network-manager/408>\
**Category:** Network\
**Created:** [September 18, 2016, 6:39pm UTC](https://linux-tips.com/t/customizing-dhcp-client-hostname-in-network-manager/408 "2016-09-18T18:39:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sputnik](https://linux-tips.com/user_avatar/linux-tips.com/sputnik/32/91_2.png) [@sputnik](https://linux-tips.com/u/sputnik)\
**Post date:** [September 18, 2016, 6:39pm UTC](https://linux-tips.com/t/customizing-dhcp-client-hostname-in-network-manager/408/1 "2016-09-18T18:39:35Z")

</div>

I’m using **network-manager** to connect different wireless and wired networks.

When requesting new ip address through dhcp, system’s hostname value put into the dhcp request as default.

It is possible to customize dhcp hostname value per interface with using `hostname` option in `/etc/network/interfaces` file but is there a similar functionality for every configured wireless ssid profile in network-manager? I need to customize dhcp hostname value for configured wireless networks.

---

<div class="post-metadata">

**Author:** ![MisterNo](https://linux-tips.com/user_avatar/linux-tips.com/misterno/32/55_2.png) [@MisterNo](https://linux-tips.com/u/MisterNo)\
**Post date:** [September 18, 2016, 7:04pm UTC](https://linux-tips.com/t/customizing-dhcp-client-hostname-in-network-manager/408/2 "2016-09-18T19:04:12Z")

</div>

Network-Manager has a lot of features. You can customize _dhcp client-hostname_ or any other option for every network profile which is managed by the network-manager (not just wireless ones).

But, there is no GUI for this type of advanced customizations. You have to use network-manager’s cli utility which is named as **nmcli**.

First of all, list configured profiles in console (just run these commands as normal user, sudo access not needed):

```auto
$ nmcli con
NAME UUID TYPE DEVICE 
VodafoneNet-9A4BX1 0c56f145-05d0-4b72-946e-c9e4a95cb962 802-11-wireless --     
miyaki 0bdcc6d1-133d-4fb4-81bd-137ebf6945f3 vpn --     
TP-LINK_AP_18480 89d6dfff-1cc0-4833-8c8b-a2727be847d6 802-11-wireless wlan1      
Wired connection 1 8cadcf80-2dd6-4198-a41b-f8e04380f1dc 802-3-ethernet --   
...  

```

Now we can get all of the details of a specific profile with `nmcli con show` command with giving profile name as last argument:

```auto
$ nmcli con show TP-LINK_AP_18480
connection.id: TP-LINK_AP_18480
connection.uuid: 89d6dfff-1cc0-4833-8c8b-a2727be847d6
802-11-wireless.ssid: TP-LINK_AP_18480
...                          
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: imac
^^^^^^^^^^^^^^^^^^^ ^^^^
...
DHCP4.OPTION[1]: requested_routers = 1
DHCP4.OPTION[2]: requested_domain_search = 1
DHCP4.OPTION[3]: network_number = 192.168.2.0
...

```

It gives very long output, I just include some parts of it.

You need to change **ipv4.dhcp-hostname** option which has current value as **imac** according the above output. To change a variable, `nmcli con modify` command must be used as below:

```auto
$ nmcli con modify TP-LINK_AP_18480 ipv4.dhcp-hostname "my-custom-hostname-01"

```

After that, network-manager will use your newly configured hostname when connecting to this wireless ssid network.

You should also check nmcli man page for other usages: [http://manpages.org/nmcli](http://manpages.org/nmcli)
