Thursday, April 5, 2018

Deny Ip private pppoe indihome


Bagi pelanggan indih*me pernah ngga dapet ip private kepala 10.xx.xx.xx ?
cara dapetin ip public caranya begini

:local iface "indomiesedap"
:if ( [/interface get $iface running] ) do={
:if ( [/ip address get [find interface=$iface] address] in 10.0.0.0/8) do={
/interface disable $iface
delay 2
/interface enable $iface
}
}

kemudian untuk report ke telegram

:local currentIP
:local externalInterface "$iface"
:set currentIP [/ip address get [find interface="$externalInterface"] address]
:for i from=( [:len $currentIP] - 1) to=0 step=-1 do={
:if ( [:pick $currentIP $i] = "/") do={
:set currentIP [:pick $currentIP 0 $i]
}
}

Sunday, April 1, 2018

variable linux ip dan interface


my_ip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
my_interface=$(ip route get 8.8.8.8 | awk '/dev/ {f=NR} f&&NR-1==f' RS=" ")

Wireless Access Point Raspberry pi 3

Dewasa ini teknologi komputasi semakin canggih. Dengan semakin canggih teknologi membuat perangkat pabrikan elektronik dibuat se-ramping mungkin.. Yah, contohnya seperti orange-pi, raspberry-pi dll. Dengan alat sekecil ini sudah mampu menjalankan desktop. Walaupun minimalis, raspberry-pi ini mampu dan siap digunakan sebagai solusi hemat listrik karena jika kebutuhan hanya sekedar display saja ngga perlu komputer bercatu daya listrik 220V. Baiklah, kali ini saya akan share cara mengaktifkan Access Point 2.4Ghz pada raspberry-pi 3.

Pertama tama install hostapd dulu

apt-get install hostapd bridge-utils -y
kemudian edit /etc/hostapd/hostapd.conf
# This is the name of the WiFi interface we configured above
interface=wlan0
# Use the nl80211 driver with the brcmfmac driver
driver=nl80211
# This is the name of the network
ssid=RaspberryWiFi
# Add to bridge
# Jika menginginkan wlan0 di bridge dengan eth0 silahkan hapus tanda #
#bridge=br0
# Use the 2.4GHz band
hw_mode=g
# Use channel 6
channel=6
# Enable 802.11n
ieee80211n=1
# Enable WMM
wmm_enabled=1
# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
# Accept all MAC addresses
macaddr_acl=0
# Use WPA authentication
auth_algs=1
# Require clients to know the network name
ignore_broadcast_ssid=0
# Use WPA2
wpa=2
# Use a pre-shared key
wpa_key_mgmt=WPA-PSK
# The network passphrase
wpa_passphrase=11223344
# Use AES, instead of TKIP
rsn_pairwise=CCMP
perhatikan yang saya beri tanda warna merah, silahkan sesuaikan. lalu edit /etc/default/hostapd
nano /etc/default/hostapd
# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"
# Additional daemon options to be appended to hostapd command:-
#       -d   show more debug messages (-dd for even more)
#       -K   include key data in debug messages
#       -t   include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""
kemudian restart service hostapd dengan cara
/etc/init.d/hostapd restart
atau
service hostapd restart

Jika dari eth0 sudah tersedia dhcp-server dari router maka kita buat bridge dengan menggabungkan eth0 dengan wlan0. Caranya :
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 wlan0
untuk melihat konfigurasi bridge silahkan ketik seperti berikut
root@new-noc:/home/pi# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.b827eba267d2       no              eth0
                                                        wlan0
kemudian buat interface baru dengan mengedit /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet manual
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto br0
iface br0 inet manual
bridge_ports eth0 wlan0


Jika sudah, silakan reboot. Silahkan konek dengan ssid yang anda buat tadi dan dengan password yang anda set di atas. Maka gadget anda mendapatkan ip dari router, karena dengan membuat bridge tadi dimaksudkan untuk menggabung eth0 dengan wlan0.