把Linux变成路由

  • A+
所属分类:运维教程

小米路由用了一段时间,这几天闲着没有事,就折腾了一下,发现里面跑的好像就是安卓系统。

玩过系统的都知道,安卓也是Linux的一种,也就是说,Linux可以作为路由器,那我们今天就来研究下,如何把Linux变成路由。

简单来说,路由器一般都具备三种功能,分别是dhcp/nat/pppoe,解释为ip自动分配,网络地址转换,拨号上网。

拨号上网这个在Linux系统集成,不需要去配置,我们只要实现dhcp和nat就行了。

dhcp的配置流程,请参考下《Linux系统配置DHCP服务》一文。

nat很简单,可以通过iptables来实现,只需两条命令即可:

echo 1 > /proc/sys/net/ipv4/ip_forward  
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.18.0/24 -j MASQUERADE

快去实验下吧!

  • 问答中心
  • 微信小程序扫一扫
  • weinxin
  • 微信公众
  • 微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:28   其中:访客  28   博主  0

    • avatar Manuelunfib

      [url=https://waterdreams37.jimdofree.com/]https://waterdreams37.jimdofree.com/[/url]

      • avatar cbd oil that works 2020

        Fantastic goods from you, man. I’ve understand your stuff previous to and you are just extremely wonderful.

        I actually like what you’ve acquired here, certainly like
        what you’re saying and the way in which you say it.
        You make it entertaining and you still care for to keep
        it wise. I can not wait to read far more from you. This is really
        a tremendous site.

        • avatar original site

          Some genuinely superb info , Gladiola I discovered this. “Treat your friends as you do your pictures, and place them in their best light.” by Jennie Jerome Churchill.

          • avatar cbd oil that works 2020

            There’s definately a great deal to learn about this topic.

            I really like all of the points you made.

            • avatar http://library.ect.go.th

              I love your blog.. very nice colors & theme. Did you design this
              website yourself or did you hire someone to do it for you? Plz respond as I’m looking to
              create my own blog and would like to find out where u got
              this from. thank you

              • avatar bidadigeleyarabalaga.org

                Pretty! This has been an extremely wonderful post. Thank you for providing this info.

                • avatar http://t.co/4kPhN7Ek0L

                  Cbd oil that works 2020
                  I got this web site from my buddy who shared with me regarding this website and
                  at the moment this time I am browsing this web site and reading very informative articles here.
                  best rated cbd oil http://t.co/4kPhN7Ek0L
                  cbd oil that works 2020 http://t.co/4kPhN7Ek0L

                  • avatar g https://tinyurl.com/rsacwgxy

                    I read this article completely regarding the comparison of latest and previous technologies, it’s remarkable
                    article.