zoukankan      html  css  js  c++  java
  • RHEL7 配置临时IP 测试

    RHEL7 配置或添加临时IP地址测试:

    [root@rhel7 Desktop]# ip a s enp0s3  ---查看原网卡IP 为192.168.1.7
    2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:73:7a:97 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.7/24 brd 192.168.1.255 scope global enp0s3
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe73:7a97/64 scope link 
           valid_lft forever preferred_lft forever
    [root@rhel7 Desktop]# ifconfig enp0s3 192.168.1.8 ---设置临时ip为192.168.1.8
    [root@rhel7 Desktop]# ip a s enp0s3
    2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:73:7a:97 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.8/24 brd 192.168.1.255 scope global enp0s3
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe73:7a97/64 scope link 
           valid_lft forever preferred_lft forever
    [root@rhel7 Desktop]# ip addr add dev enp0s3 192.168.1.222 --添加一个临时ip 192.168.1.222
    [root@rhel7 Desktop]# ip a s enp0s3
    2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:73:7a:97 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.8/24 brd 192.168.1.255 scope global enp0s3
           valid_lft forever preferred_lft forever
        inet 192.168.1.222/32 scope global enp0s3
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe73:7a97/64 scope link 
           valid_lft forever preferred_lft forever
    [root@rhel7 Desktop]# nmcli connection down enp0s3  --重启网卡后恢复为原来的IP192.168.1.7
    Connection 'enp0s3' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
    [root@rhel7 Desktop]# nmcli connection up enp0s3 
    Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
    [root@rhel7 Desktop]# ip a s enp0s3
    2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:73:7a:97 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.7/24 brd 192.168.1.255 scope global enp0s3
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe73:7a97/64 scope link 
           valid_lft forever preferred_lft forever
    [root@rhel7 Desktop]# 
  • 相关阅读:
    libpcap编程实例
    libnet发包例子(tcp udp arp广播)
    C#中一个窗口是一个类呢,还是一个窗口类的实例呢?(转)
    创建一个实例&创建一个线程。。
    (转)C#中的 Interfaces (For 初学者们)
    C#中接口声明属性,但是提示“接口”中不能有属性。
    十万个为什么:现在还没发现“虚函数virtual”和多态性的优点,估计是因为我还没有编程序吧。
    C#中的多态性
    Windows 程序支持 Unicode
    Python 中的函数与类的方法
  • 原文地址:https://www.cnblogs.com/rusking/p/7425785.html
Copyright © 2011-2022 走看看