{"id":5844,"date":"2014-06-12T17:02:25","date_gmt":"2014-06-12T22:02:25","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=5844"},"modified":"2014-06-17T16:42:59","modified_gmt":"2014-06-17T21:42:59","slug":"ocg-scripts","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/corecdp\/applications\/ocg-scripts\/","title":{"rendered":"OCG Scripts"},"content":{"rendered":"<p>The ocg-scripts recipe provides a small set of simple scripts that are useful for demos, testing, and as examples for developers. They are not intended to be full-featured scripts that cover a wide-range of use cases.<\/p>\n<h4>ocg-cell-router<\/h4>\n<p>Configures the OCG as a basic network router\/firewall. All incoming connections on the WAN are blocked by default and all outbound traffic from the LAN is allowed. Enables IP forwarding and masquerading\/NAT.<\/p>\n<pre>\r\n  Usage: ocg-cell-router start|stop [options]\r\n    options:\r\n      -l <lan-interfaces> LAN interfaces to allow, comma-separated (defaults to \"eth0\")\r\n      -w <wan-interface>  WAN interface to route out (defaults to \"ppp0\")\r\n<\/pre>\n<h4>ocg-set-apn<\/h4>\n<p>Helper script to set the APN in the <code>\/etc\/ppp\/peers\/gsm_chat<\/code> file, rather than having to edit it by hand.<\/p>\n<pre>\r\n  Usage: ocg-set-apn APN\r\n<\/pre>\n<h4>ocg-dhcpd<\/h4>\n<p>Simple script to stop and start the busybox udhcpd server. To edit dhcpd config, edit <code>\/etc\/udhcpd.conf<\/code>. The default configuration works with the default IP address of 192.168.2.1 and subnet mask of 255.255.255.0.<\/p>\n<pre>\r\n  Usage: ocg-dhcpd start|stop|restart\r\n<\/pre>\n<h4>ocg-wifi-ap<\/h4>\n<p>Enables a Wi-Fi AP on the OCG.  Tested with MT100EOCG + MTPCIE-H5-BW with integrated Bluetooth\/Wifi (other hardware configurations don&#8217;t have Wi-Fi support).<\/p>\n<p>Starts and stops hostapd and dhcpd with some minimal configuration. By default, it enables an access point on 192.168.3.1 so as not to conflict with the default ethernet address of 192.168.2.1. DHCP server will run on Wi-Fi only unless it is bridged with the ethernet interface.<\/p>\n<p>The script will only automatically modify a few settings. Any other changes need to be made to <code>\/etc\/hostapd.conf<\/code> and <code>\/etc\/udhcpd.conf<\/code> manually.<\/p>\n<p>Automatically enables\/disables bridge mode in <code>\/etc\/hostapd.conf<\/code> as needed<br \/>\nConfigures router address and DHCP address range in \/etc\/udhcdp.conf to match wlan0 address if &#8220;-a&#8221; option is used<\/p>\n<pre>\r\n  Usage: ocg-wifi-ap start|stop|restart [options]\r\n    options:\r\n      -a <address>    Sets AP IP address (defaults to 192.168.3.1)\r\n      -b <interface>  Add AP to specified bridge interface (conflicts with -a)\r\n<\/pre>\n<h4>Examples<\/h4>\n<h5>Ethernet to Cellular router example<\/h5>\n<pre class=\"brush:text\">\r\nocg-set-apn APN (one-time only for GSM connections)\r\nocg-cell-router start\r\nocg-dhcpd start\r\npppd call gsm\r\n<\/pre>\n<h5>Wifi AP to Cellular router with Ethernet on separate subnets and DHCP on Wifi only<\/h5>\n<pre class=\"brush:text\">\r\nocg-set-apn APN (one-time only for GSM connections)\r\nocg-cell-router start -l eth0,wlan0\r\nocg-wifi-ap start\r\npppd call gsm\r\n<\/pre>\n<h5>Wifi AP and Ethernet bridged Cellular router<\/h5>\n<pre class=\"brush:text\">\r\nEdit \/etc\/network\/interfaces -- enable br0 and disable normal eth0 setup\r\nreboot\r\nocg-set-apn APN (one-time only for GSM connections)\r\nocg-cell-router start -l br0\r\nocg-wifi-ap start -b br0\r\npppd call gsm\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The ocg-scripts recipe provides a small set of simple scripts that are useful for demos, testing, and as examples for developers. They are not intended to be full-featured scripts that cover a wide-range of use cases. ocg-cell-router Configures the OCG as a basic network router\/firewall. All incoming connections on the WAN are blocked by default [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":324,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-5844","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/5844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=5844"}],"version-history":[{"count":14,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/5844\/revisions"}],"predecessor-version":[{"id":5894,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/5844\/revisions\/5894"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/324"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=5844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}