Categories
Tech Tips

How to make dhclient send hostname to DHCP server


My Arch Linux recently switched from dhcpcd to dhclient as the DHCP client. The DHCP server isn’t assigning a FQDN to this client and it turns out that dhclient isn’t telling the server what’s the client’s hostname.

Solution:

Create config file /etc/dhclient.conf with content:

send host-name = gethostname();

Categories
Tech Tips

How to check if promiscuous mode is enabled on network interface in Linux

$ netstat -i

Look under the last column “Flg” for value “P”. If it’s there, it means promiscuous mode is enabled for that network interface. Is the flag really P and not M? Here’s a quick test. Check existing active flags:

[root@localhost ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     2075      0      0      0     1366      0      0      0 BMRU
lo        16436   0     1985      0      0      0     1985      0      0      0 LRU

Turn multicast off on eth0:

[root@localhost ~]# ip link set eth0 multicast off

Notice that the ‘M’ flag is gone? So, M is for multicast:

[root@localhost ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     2075      0      0      0     1369      0      0      0 BRU
lo        16436   0     1985      0      0      0     1985      0      0      0 LRU

Turn promiscuous mode on:

[root@localhost ~]# ip link set eth0 promisc on

Notice that the ‘P’ flag is now shown:

[root@localhost ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     2075      0      0      0     1370      0      0      0 BPRU
lo        16436   0     1985      0      0      0     1985      0      0      0 LRU

UPDATE 20130531: This post wrongly indicated that the “M” flag indicates promiscuous mode. Sorry for the confusion. I got that from other incorrect sources as well. It seems quite many online sources got that wrong. Thanks to the helpful commenters for correcting this mistake.

Categories
Tech Tips

How to tether with the HTC Hero?

How to surf the net on a Vista laptop by using the “Mobile network” connection on the Hero?

0. Install HTC Sync on Vista

1. Turn on “Mobile network” HSPA connection on Hero

2. Connect Hero to PC via USB cable. If it prompted to install a new driver but auto search for driver failed, manually point it to the “inf” file in C:\Program Files\HTC\HTC Driver\Driver Files\Vista_x86

3. On Hero: Menu > Settings > Wireless Controls > Mobile network sharing (click to turn on)
=> Skip this step if you forgot to do Step-5 previously cos it’ll auto connect

4. It may take 3-5 mins to connect. Monitor the handshake process by clicking once on the network connection icon in the system tray on the laptop (assume Vista). When you see this, the tethering is complete and successful:

Currently connected to:
<Some new network name>
Access: Local and Internet

5. When you are done tethering, turn it off on Hero:
Menu > Settings > Wireless Controls > Mobile network sharing (click to turn off)
=> It’s better to turn off to prevent accidental use while charging phone

6. Turn off “Mobile network” HSPA connection on Hero