herozzm
V2EX  ›  Debian

debian 10 如何快捷的将 xx.xx.xx.2-254 200 多个 ip 绑定在一个网口上?

  •  
  •   herozzm · Jul 17, 2020 · 3014 views
    This topic created in 2300 days ago, the information mentioned may be changed or developed.
    找到这个教程: https://wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_one_Interface
    但是一个一个 ip 硬写上去的,有 200 多个 ip,有没有快捷的写法?
    4 replies  •  2020-07-17 10:53:46 +08:00
    billlee
    billlee
    Jul 17, 2020
    1
    写个 shell 脚本调用 ip addr add
    onetown
    onetown
    Jul 17, 2020❤️2
    2
    DEV=eth0
    PREFIX=192.168.1
    for N in {2..254}; do ip addr add $PREFIX.$N dev $DEV; done;
    ruanimal
    ruanimal
    Jul 17, 2020❤️1
    3
    for ip in 192.168.{1..254}; do ip addr add $ip dev $DEV; done
    herozzm
    herozzm
    OP
    Jul 17, 2020
    4
    @onetown
    @ruanimal 感谢老铁们
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5131 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:32 · PVG 09:32 · LAX 17:32 · JFK 20:32
    ♥ Do have faith in what you're doing.