Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utils #9

Open
wants to merge 3 commits into
base: kinetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions utils/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
How to use scripts:

1. To Create Acces Point write sudo ./createap.sh
2. To Destroy Acces Point write sudo ./destroyap.sh
44 changes: 44 additions & 0 deletions utils/createap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

echo ScriptBegins!


sudo systemctl stop dnsmasq
sudo systemctl stop hostapd

rm /etc/dhcpcd.conf
cp dhcpcd.conf /etc/dhcpcd.conf

sudo service dhcpcd restart

rm /etc/dnsmasq.conf
cp dnsmasq.conf /etc/dnsmasq.conf

sudo systemctl start dnsmasq

rm /etc/hostapd/hostapd.conf
cp hostapd.conf /etc/hostapd/hostapd.conf

rm /etc/default/hostapd
cp hostapd /etc/default/hostapd

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd



rm /etc/sysctl.conf
cp sysctl.conf /etc/sysctl.conf

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"


rm /etc/rc.local
cp rc.local /etc/rc.local

echo Script finished


38 changes: 38 additions & 0 deletions utils/destroyap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

echo ScriptBegins!


sudo systemctl stop dnsmasq
sudo systemctl stop hostapd

rm /etc/dhcpcd.conf
cp dhcp.conf.orig /etc/dhcpcd.conf

sudo service dhcpcd restart

rm /etc/dnsmasq.conf
cp dnsmasq.conf.orig /etc/dnsmasq.conf

sudo systemctl start dnsmasq

rm /etc/hostapd/hostapd.conf
cp hostapd.conf.orig /etc/hostapd/hostapd.conf

rm /etc/default/hostapd
cp hostapd.orig /etc/default/hostapd

sudo systemctl mask hostapd
sudo systemctl disable hostapd
sudo systemctl stop hostapd


rm /etc/sysctl.conf
cp sysctl.conf.orig /etc/sysctl.conf

rm /etc/rc.local
cp rc.local.orig /etc/rc.local

echo Script finished


60 changes: 60 additions & 0 deletions utils/dhcp.conf.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

63 changes: 63 additions & 0 deletions utils/dhcpcd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
2 changes: 2 additions & 0 deletions utils/dnsmasq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
interface=wlan0 # Use the require wireless interface - usually wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
Loading