Network/Ethernet/DHCP

enx*MACADDRESS* Link encap:Ethernet HWaddr **:**:**:**:**:**

create file/etc/udev/rules.d/70-persistent-net.rulesand put this in

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:ac:6f:65:31:e5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

replaceb8:ac:6f:65:31:e5 with your eth0 MAC address, reboot and it will become eth0, you may not have internet access after reboot because in /etc/network/interfaces is defining wrong interface, just change enx* to eth0

Start and Stop DHCP Service

For Ubuntu use:

$ sudo service isc-dhcp-server start
$ sudo service isc-dhcp-server stop
$ sudo service isc-dhcp-server stop

or

$ sudo /etc/init.d/isc-dhcp-server start
$ sudo /etc/init.d/isc-dhcp-server stop
$ sudo /etc/init.d/isc-dhcp-server restart
sudo service --status-all | grep dhcp

/etc/dhcp/dhcpd.conf

Global Setting

  • default-lease-time:
  • max-lease-time:
  • option domain-name:
  • ddns-update-style:
  • ignore client-updates:
  • option routers:

IP Setting (dynamic or static)

subnet NETWORK_IP netmask NETMASK_IP { ... }

  • range IP1 IP2:
  • host HOST_NAME{ ... }
    • hardware ethernet:
    • fixed-address:

/usr/sbin/dhcpd

/var/lib/dhcp/dhcpd.leases

sudo netstat -tlunp | grep dhcp

vim /etc/hosts

vim /etc/network/isc-dhcp-server

INTERFACES="" // none

vim /etc/network/interfaces

auto lo eth0

iface eth0 inet dhcp

iface lo inet loopback

Dynamic Network Configuration

The utility udhcpc can be used to get a one time lease for an IP address from the DHCP server serving the local network:

# udhcpc -i eth0
udhcpc (v1.23.2) started
...
Sending discover...
Sending select for 192.168.10.108...
Lease of 192.168.10.108 obtained, lease time 86400
...

References:

BusyBox 應用 – udhcpc

http://felix-lin.com/linux/busybox-%E6%87%89%E7%94%A8-udhcpc/

results for ""

    No results matching ""