def get_local_ip(ifname='eth0'):
    """
        prefix = enp2s0  or eth0
    :param ifname:
    :return:
    """
    import socket, fcntl, struct
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 35093, struct.pack(
        '256s', bytes(ifname[:15], 'utf-8')))[20:24])
