美文网首页
Augmented Traffic Control

Augmented Traffic Control

作者: 藝龍 | 来源:发表于2017-10-23 15:09 被阅读0次

    Augmented Traffic Control

    Full documentation for the project is available at http://facebook.github.io/augmented-traffic-control/.

    Requirements

    Most requirements are handled automatically by pip, the packaging system used by ATC, and each ATC package may have different requirements and the README.md files of the respective packages should be checked for more details. Anyhow, some requirements apply to the overall codebase:

    • Python 2.7: Currently, ATC is only supported on python version 2.7.
    • Django 1.10: Currently, ATC is only supported using django version 1.10.

    Installing ATC

    The fact that ATC is splitted in multiple packages allows for multiple deployment scenarii. However, deploying all the packages on the same host is the simplest and most likely fitting most use cases.

    To get more details on how to install/configure each packages, please refer to the packages' respective READMEs.

    Packages

    The easiest way to install ATC is by using pip.

    pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage
    

    Django

    Now that we have all the packages installed, we need to create a new Django project in which we will use our Django app.

    django-admin startproject atcui
    cd atcui
    

    Now that we have our django project, we need to configure it to use our apps and we need to tell it how to route to our apps.

    Open atcui/settings.py and enable the ATC apps by adding to INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        # Django ATC API
        'rest_framework',
        'atc_api',
        # Django ATC Demo UI
        'bootstrap_themes',
        'django_static_jquery',
        'atc_demo_ui',
        # Django ATC Profile Storage
        'atc_profile_storage',
    )
    

    Now, open atcui/urls.py and enable routing to the ATC apps by adding the routes to urlpatterns:

    ...
    ...
    from django.views.generic.base import RedirectView
    from django.conf.urls import include
    
    urlpatterns = [
        ...
        # Django ATC API
        url(r'^api/v1/', include('atc_api.urls')),
        # Django ATC Demo UI
        url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),
        # Django ATC profile storage
        url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),
        url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),
    ]
    

    Finally, let's update the Django DB:

    python manage.py migrate
    

    Running ATC

    All require packages should now be installed and configured. We now need to run the daemon and the UI interface. While we will run ATC straight from the command line in this example, you can refer to example sysvinit and upstart scripts.

    atcd

    atcd modifies network related settings and as such needs to run in privileged mode:

    sudo atcd
    

    Supposing eth0 is your interface to connect to the internet and eth1 is your interface to connect to your lan, this should just work. If your setting is slightly different, use the command line arguments --atcd-wan and --atcd-lan to adapt to your configuration.

    sudo atcd --atcd-wan eth0(无线网卡) --atcd-lan eth1(以太网卡)
    

    ATC UI

    The UI on the other hand is a standard Django Web app and can be run as a normal user. Make sure you are in the directory that was created when you ran django-admin startproject atcui and run:

    python manage.py runserver 0.0.0.0:8000
    

    You should now be able to access the web UI at http://localhost:8000

    创建无线热点

    点击网络连接


    点击增加


    如下图各个配置项





    IPv6选择忽略

    ATC使用

    连接创建好的Wi-Fi热点,访问http://localhost:8000,页面如下:

    创建好合适的网络条件以后,选择,点击最上面的Update Shaping,网络就已经设置好了

    相关文章

      网友评论

          本文标题:Augmented Traffic Control

          本文链接:https://www.haomeiwen.com/subject/dtdauxtx.html