tssltd:получение_ip_адреса_по_протоколу_dhcp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tssltd:получение_ip_адреса_по_протоколу_dhcp [2022/10/24 12:27] – i.sharapov | tssltd:получение_ip_адреса_по_протоколу_dhcp [2023/10/06 13:23] (current) – n.ganenkov | ||
---|---|---|---|
Line 1: | Line 1: | ||
[[tssltd: | [[tssltd: | ||
- | === Получение сетевых настрое по протоколу DHCP === | + | ==== Получение сетевых настроек по протоколу DHCP ==== |
- | < | + | < |
- | Для автоматического получения сетевых настроек | + | Для автоматического получения сетевых настроек необходимо подключиться к устройству по протоколу ssh. Утилита «**udhcp**» позволяет управлять сетевыми настройками. Для вызова справки по дополнительным опциям необходимо выполнить команду |
- | + | ||
- | {{ :tssltd:5q.jpg |}} | + | < |
- | Рисунок 1 – Работа команды | + | # udhcpc |
+ | udhcpc: option requires an argument -- ' | ||
+ | BusyBox v1.31.0 | ||
+ | |||
+ | Usage: udhcpc [-fbqRB] [-a[MSEC]] [-t N] [-T SEC] [-A SEC/-n] | ||
+ | [-i IFACE] [-s PROG] [-p PIDFILE] | ||
+ | [-oC] [-r IP] [-V VENDOR] [-F NAME] [-x OPT:VAL]... [-O OPT]... | ||
+ | |||
+ | -i IFACE Interface to use (default eth0) | ||
+ | -s PROG Run PROG at DHCP events (default / | ||
+ | -p FILE | ||
+ | -B Request broadcast replies | ||
+ | -t N Send up to N discover packets (default 3) | ||
+ | -T SEC Pause between packets (default 3) | ||
+ | -A SEC Wait if lease is not obtained (default 20) | ||
+ | -b Background if lease is not obtained | ||
+ | -n Exit if lease is not obtained | ||
+ | -q Exit after obtaining lease | ||
+ | -R Release IP on exit | ||
+ | -f Run in foreground | ||
+ | -S Log to syslog too | ||
+ | -a[MSEC] | ||
+ | -r IP | ||
+ | -o Don't request any options (unless -O is given) | ||
+ | -O OPT Request option OPT from server (cumulative) | ||
+ | -x OPT: | ||
+ | Examples of string, numeric, and hex byte opts: | ||
+ | -x hostname: | ||
+ | -x lease:3600 - option 51 (lease time) | ||
+ | -x 0x3d: | ||
+ | -x 14:'" | ||
+ | -F NAME Ask server to update DNS mapping for NAME | ||
+ | -V VENDOR | ||
+ | -C Don't send MAC as client identifier | ||
+ | Signals: | ||
+ | USR1 Renew lease | ||
+ | USR2 Release lease | ||
+ | </ | ||
+ | |||
+ | | ||
+ | |||
+ | < | ||
+ | # udhcpc -i eth2 | ||
+ | udhcpc: started, v1.31.0 | ||
+ | udhcpc: sending discover | ||
+ | udhcpc: sending select for 192.168.101.138 | ||
+ | udhcpc: lease of 192.168.101.138 obtained, lease time 25200 | ||
+ | deleting routers | ||
+ | adding dns 77.88.8.8 | ||
+ | adding dns 77.88.8.1 | ||
+ | </ | ||
+ | Для автоматического запуска **udhcpc** при загрузке устройства необходимо добавить команду в скрипт **run-post.sh**, | ||
+ | |||
+ | < | ||
+ | # nano / | ||
+ | </ | ||
+ | <WRAP center round box 100%> | ||
+ | {{ :tssltd:udhcpc_run-post.png |}} | ||
+ | |||
+ | __//Изобр. 6.c.1. Добавление | ||
+ | </ | ||
- | | ||
- | |||
- | {{ : | ||
- | Рисунок 2 – Работа команды «udhcp –i < | ||
</ | </ | ||
+ | [[tssltd: |
tssltd/получение_ip_адреса_по_протоколу_dhcp.1666603635.txt.gz · Last modified: 2022/10/24 12:27 by i.sharapov