This topic created in 2469 days ago, the information mentioned may be changed or developed.
最近批量部署时修改 ip 的操作很多 不想直接编辑网络配置文件 /etc/network/interfaces 或者 sed 替换
ifconfig eth0 172.16.0.1/16 它能满足我的需求, 可重启后就没了,
期望的工具达到 ifconfig 这样易用,并把相关的配置保存到网络配置文件中
网上找了一圈没发现,netplan 也需要 yaml 配置文件, 太麻烦,不易用。
到时实在没有就准备自己造个轮子。
14 replies • 2019-10-28 01:57:39 +08:00
 |
|
1
saxon Aug 8, 2019
很遗憾 没有,自己写 shell 吧
|
 |
|
4
lowman Aug 8, 2019
哈哈哈, 这个头像好像一坨屎
|
 |
|
5
CCIEliu Aug 8, 2019
[root@localhost ~]# ezcli
Usage: ezcli [ensXX] ip addr [ADDRESS] [MASK] gw [GATEWAY]
========================== ens192: 99.99.99.2/24 ens224: 12.1.1.11/24
========================== Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 99.99.99.1 0.0.0.0 UG 101 0 0 ens192 12.1.1.0 0.0.0.0 255.255.255.0 U 102 0 0 ens224 99.99.99.0 0.0.0.0 255.255.255.0 U 101 0 0 ens192
========================== Address HWtype HWaddress Flags Mask Iface 12.1.1.31 ether 00:50:56:8e:49:98 C ens224 99.99.99.1 ether 00:50:56:8e:f5:6b C ens192 99.99.99.253 ether 00:22:bd:f8:19:ff C ens192 12.1.1.253 ether 00:22:bd:f8:19:ff C ens224
|
 |
|
6
snip Aug 8, 2019
先清空,在 echo
|
 |
|
7
klh Aug 8, 2019
万一是 ubuntu
|
 |
|
8
crazykylin Aug 8, 2019
3 楼的办法也不错, 不过我在 win 下用 quicker 软件写了一个脚本配上快捷键, 讲真比 shell 还方便
|
 |
|
11
whitev2 Aug 8, 2019
试试 nmcli 工具?其实应该在批量部署的时候 ip 就写到脚本里
|
 |
|
13
vhwwls Aug 9, 2019
这个比较简单,用 iproute2(ip 命令)和文本三剑客就可以做,实在不行你自己写个 shell 也是很方便的。
|
 |
|
14
smyle Oct 28, 2019 via Android
nmcli 或者 nmstate,修改都是写入硬盘配置的
|