同网段的话,直接修改,不同网段的话,使用以下方法: 步骤一:nova list --all-tenant 找到相应虚拟机+--------------------------------------+----------+--------+------------+-------------+-------------------+| ID | Name | Status | Task State | Power State | Networks |+----------------------…
getifaddrs()和struct ifaddrs的使用,获取本机IP ifaddrs结构体定义如下: struct ifaddrs { struct ifaddrs *ifa_next; /* Next item in list */ char *ifa_name; /* Name of interface */ unsigned int ifa_flags; /* Flags from SIOCGIFFLAGS */ struct sockaddr *ifa_addr; /* Addre…