亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓課程 | 模擬考場 | 考試論壇  
        當前位置:操作系統(tǒng) > Linux > 文章內(nèi)容
        

      Linux基礎(chǔ)教程:在Ubuntu15.10上為單個網(wǎng)卡設(shè)置多個IP地址

       [ 2016年2月14日 ] 【

      現(xiàn)在,讓我們來分配一個額外的地址,例如 192.168.1.104/24。

      編輯 /etc/network/interfaces

      1. sudonano/etc/network/interfaces

      如下添加額外的 IP 地址。

      1. #Thisfile describes the network interfaces available on your system
      2. #and how to activate them.Formore information, see interfaces(5).
      3. source /etc/network/interfaces.d/*
      4. # The loopback network interface
      5. auto lo
      6. iface lo inet loopback
      7. # The primary network interface
      8. auto enp0s3
      9. iface enp0s3 inet dhcp
      10. iface enp0s3 inet static
      11. address 192.168.1.104/24

      保存并關(guān)閉文件。

      運行下面的命令使更改無需重啟即生效。

      1. sudo ifdown enp0s3 &&sudo ifup enp0s3

      樣例輸出:

      1. Killed old client process
      2. InternetSystemsConsortium DHCP Client4.3.1
      3. Copyright2004-2014InternetSystemsConsortium.
      4. All rights reserved.
      5. Forinfo, please visit https://www.isc.org/software/dhcp/
      6. Listening on LPF/enp0s3/08:00:27:2a:03:4e
      7. Sending on LPF/enp0s3/08:00:27:2a:03:4e
      8. Sending on Socket/fallback
      9. DHCPRELEASE on enp0s3 to 192.168.1.1 port 67(xid=0x225f35)
      10. InternetSystemsConsortium DHCP Client4.3.1
      11. Copyright2004-2014InternetSystemsConsortium.
      12. All rights reserved.
      13. Forinfo, please visit https://www.isc.org/software/dhcp/
      14. Listening on LPF/enp0s3/08:00:27:2a:03:4e
      15. Sending on LPF/enp0s3/08:00:27:2a:03:4e
      16. Sending on Socket/fallback
      17. DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3(xid=0xdfb94764)
      18. DHCPREQUEST of 192.168.1.103 on enp0s3 to 255.255.255.255 port 67(xid=0x6447b9df)
      19. DHCPOFFER of 192.168.1.103from192.168.1.1
      20. DHCPACK of 192.168.1.103from192.168.1.1
      21. bound to 192.168.1.103-- renewal in35146 seconds.

      注意:如果你從遠程連接到服務器,把上面的兩個命令放到一行非常重要,因為第一個命令會斷掉你的連接。而采用這種方式可以保留你的 ssh 會話。

      現(xiàn)在,讓我們用下面的命令來檢查一下是否添加了新的 IP:

      1. sudoip address show enp0s3

      輸出樣例:

      1. 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
      2. link/ether 08:00:27:2a:03:4e brd ff:ff:ff:ff:ff:ff
      3. inet 192.168.1.103/24 brd 192.168.1.255 scope global enp0s3
      4. valid_lft forever preferred_lft forever
      5. inet 192.168.1.104/24 brd 192.168.1.255 scope global secondary enp0s3
      6. valid_lft forever preferred_lft forever
      7. inet6 fe80::a00:27ff:fe2a:34e/64 scope link
      8. valid_lft forever preferred_lft forever

      很好!我們已經(jīng)添加了額外的 IP。

      再次 ping IP 地址進行驗證。

      1. sudoping192.168.1.104

      樣例輸出:

      1. PING 192.168.1.104(192.168.1.104)56(84) bytes of data.
      2. 64 bytes from192.168.1.104: icmp_seq=1 ttl=64time=0.137 ms
      3. 64 bytes from192.168.1.104: icmp_seq=2 ttl=64time=0.050 ms
      4. 64 bytes from192.168.1.104: icmp_seq=3 ttl=64time=0.054 ms
      5. 64 bytes from192.168.1.104: icmp_seq=4 ttl=64time=0.067 ms

      好極了!它能正常工作。就是這樣。

      首頁 1 2 尾頁
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動訪問考試網(wǎng) | 復制本頁地址,傳給QQ/MSN上的好友 | 申請鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務  聯(lián)系方式  站內(nèi)導航  考試論壇
      Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved