V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Recommended Services
Amazon Web Services
LeanCloud
New Relic
ClearDB
whx20202
V2EX  ›  云计算

阿里云随机器购买的公网 IP 不在网卡上,怎么运行程序在这个 IP 上?

  •  
  •   whx20202 · 2016-11-14 00:11:05 +08:00 · 6249 次点击
    这是一个创建于 2725 天前的主题,其中的信息可能已经有所发展或是发生改变。

    就是买 ECS 机器自带了一个公网 IP ,然后 ifconfig 看不到公网 IP

    那我现在运行的程序想指定运行在 IP 上怎么办?

    15 条回复    2020-02-02 17:23:05 +08:00
    skyeycirno
        1
    skyeycirno  
       2016-11-14 00:27:37 +08:00 via iPhone
    内网 ip ?
    haitang
        2
    haitang  
       2016-11-14 00:32:52 +08:00
    貌似是内网 IP ? ifconfig 看下,直接绑定内网 IP 即可,会转发到内网 IP
    OrangeM21
        3
    OrangeM21  
       2016-11-14 00:38:17 +08:00
    如果是经典机器,这个 ip 是在网卡上的;
    如果是专用网络机器,这个是公网 IP 在路由器上的,无法到服务器上。
    相信我,我踩过这些坑。
    OrangeM21
        4
    OrangeM21  
       2016-11-14 00:38:52 +08:00
    二楼说的是‘直接绑定内网 IP 即可,会转发到公网 IP ’
    shoaly
        5
    shoaly  
       2016-11-14 01:57:17 +08:00
    0.0.0.0:74234
    panda1001
        6
    panda1001  
       2016-11-14 08:07:40 +08:00 via Android
    楼上正解 监听 0.0.0.0 缺省路由
    CupTools
        7
    CupTools  
       2016-11-14 08:15:38 +08:00
    或者你可以做 net.ipv4.ip_nonlocal_bind ,然后强制 bind 到你的公网 IP 。但是这样就没有优势了
    dudesun
        8
    dudesun  
       2016-11-14 09:21:23 +08:00
    vpc 吧,你 bind 到 0000 就 OK
    Keyes
        9
    Keyes  
       2016-11-14 09:26:19 +08:00
    看到 0.0.0.0:74234 莫名戳中笑点
    ndd200
        10
    ndd200  
       2016-11-14 09:44:20 +08:00
    @Keyes 好高深的段子。
    yghack
        11
    yghack  
       2016-11-14 09:56:49 +08:00
    NAT 的 IP
    0.0.0.0
    smileawei
        12
    smileawei  
       2016-11-14 15:14:59 +08:00
    @Keyes 二次元端口。
    mytsing520
        13
    mytsing520  
       2016-11-21 16:14:07 +08:00
    NAT
    chendeshen
        14
    chendeshen  
       2018-08-29 07:47:22 +08:00
    现在腾讯云,永远有一层 NAT,不能直接有外网网卡。
    现在阿里云,也是如此。只有专有网络可选,坑爹。看了一下,以前的经典网络有外网网卡。
    看到: https://help.aliyun.com/document_detail/61651.html
    写着:
    <quote>说明:
    如果您在 2017 年 6 月 14 日下午 5 点( UTC+8 时间)以后第一次购买 ECS 实例,不能选择经典网络。</quote>

    谁有 2017 年 6 月 14 日下午 5 点( UTC+8 时间)前买过 ECS 实例的阿里云账号,可以借或卖我?
    Dark1X
        15
    Dark1X  
       2020-02-02 17:23:05 +08:00
    令人头秃
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   823 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:55 · PVG 05:55 · LAX 14:55 · JFK 17:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.