当前位置:网站首页>A fault record of misoperation dhclient script

A fault record of misoperation dhclient script

2022-06-24 11:15:00 gourd

One about misoperation dhclient-script Fault records

A dhclient-script failure record for an incorrect operation

cause

Causes

Because there is one that serves aws Domain name resolution failed for , The business cannot be released normally . Domestic analysis aws Domain name failed , Foreign Normal . Here are two solutions :

  1. To configure hosts
  2. modify /etc/resolv.conf modify hosts Can solve the problem temporarily , But if aws Changed the direction , It needs to be modified . So use the second method . But when it's done /etc/resolv.conf after , Carry out orders service network restart, Will find /etc/resolv.conf Reset , Invalidate a modification . It's because /usr/sbin/dhclient-script Caused by .

Because of a moment's negligence, he directly carried out :

mv /usr/sbin/dhclient-script /usr/sbin/dhclient-scriptbak
service network restart

After the execution, he looks confused ,ec2 It's a brick , Link broken , No more links .

Due to a domain name resolution failure for AWS, the business cannot be published normally.

Domestic resolution of AWS domain failed, foreign normal.

There are two solutions:

  1. The configuration of hosts
  2. Modify the/etc/resolv. Conf

Modifying Hosts can solve the problem temporarily, but you will need to make further changes if AWS is directed elsewhere.

So use the second method.

But when modifying the/etc/resolv. Conf, execute the command service network restart, will find that the/etc/resolv. Conf reset, disable modification.

/usr/sbin/dhclient-script = /usr/sbin/dhclient-script = /usr/sbin/dhclient-script

To execute directly out of an oversight:

mv /usr/sbin/dhclient-script /usr/sbin/dhclient-scriptbak
service network restart

After the implementation of a face of muddled, EC2 into a brick, the link is broken, can not be linked.

Start repairing

Begin to repair

Repair ideas : Mount the problem disk to a computer that can be connected normally ec2 On , After the repair , Hang up again . Because of this ec2 machine , There are two disks attached to it , Namely /dev/xvda(root device) and /dev/sdb.

  1. Make /dev/xvda snapshot.
  2. from snapshot establish volume.
  3. take volume Mount to normal ec2 On the machine /dev/sdf1.
  4. Carry out orders
mkdir /fix
mount /dev/sdf1 /fix
mv /fix/usr/sbin/dhclient-scriptbak /usr/sbin/dhclient-script
umount /dev/sdf1
  1. stay aws Admiral volume From normal ec2 detach.
  2. Shut down the faulty machine , uninstall /dev/xvda.
  3. What will be repaired volume Mount back to fault ec2 Of root Partition . Partition path /dev/xvda
  4. Start the faulty machine , Complete the repair .

repair idea: mounts the defective disk to a normally connected EC2, fixes it, and then mounts it back. has two disks mounted on this EC2 machine, /dev/xvda(root device) and /dev/sdb.

  1. Make /dev/xvda snapshot.
  2. Create volume from snapshot
  3. Mount the volume on /dev/sdf1 on a normal EC2 machine.
  4. Follow orders
mkdir /fix
mount /dev/sdf1 /fix
mv /fix/usr/sbin/dhclient-scriptbak /usr/sbin/dhclient-script
umount /dev/sdf1
  1. Remove the volume from normal EC2 detach on AWS.
  2. Shutdown the failed machine and uninstall /dev/xvda.
  3. Re-mount the repaired volume back into the root partition of the failed EC2. Partition path /dev/xvda
  4. Start the faulty machine and complete the repair.

dhclient-script Introduce

DHCP From time to time, the client's network configuration script is dhclient call . This script is dhcp The client is used to set the initial configuration of each interface before requesting the address , Test after the address is provided , And set the final configuration of the interface after obtaining the lease . This script doesn't mean it can be customized by the end user . If local customization is needed , You should be able to use the input and output hooks provided . These hooks will allow the user to create /etc/resolv.conf The default behavior of the client is overridden when a file is created . When it starts , The client script first defines a shell function ,make_resolv_conf, It was then used to create /etc/resolv.conf file . To override the default behavior , Please redefine this function in the hook script .

dhclient-script Introduction

The DHCP client network configuration script is invoked from time to time by dhclient. This script is used by the dhcp client to set each interface’s initial configuration prior to requesting an address, to test the address once it has been offered, and to set the interface’s final configuration once a lease has been acquired. This script is not meant to be customized by the end user. If local customizations are needed, they should be possible using the enter and exit hooks provided. These hooks will allow the user to override the default behavior of the client in creating a /etc/resolv.conf file. When it starts, the client script first defines a shell function, make_resolv_conf, which is later used to create the /etc/resolv.conf file. To override the default behavior, redefine this function in the enter hook script. Personal blog : https://www.bthlt.com

原网站

版权声明
本文为[gourd]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/06/20210604184023846Y.html