dimanche 24 septembre 2017

Accès WIFI

lsusb 
Bus 001 Device 004: ID 0846:9030 NetGear, Inc. WNA1100 Wireless-N 150 [Atheros AR9271] Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 

apt-get update 
apt-get install hostapd

cat /etc/hostapd/hostapd.conf
 interface=wlan0
ssid=RaspberryAP
hw_mode=g
channel=11
wpa=2
wpa_passphrase=smartHome
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP


apt-get install isc-dhcp-server

cat /etc/default/isc-dhcp-server
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
#    Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#    Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="wlan0"


cat /etc/dhcp/dhcpd.conf
# Sample configuration file for ISC dhcpd for Debian # The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none; # option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600;
max-lease-time 7200; # If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative; # Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7; # No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
# A slightly different configuration for an internal subnet.
subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.10 192.168.0.30;
#  option domain-name-servers ns1.internal.example.org;
#  option domain-name "internal.example.org";
#  option routers 10.5.5.1;
#  option broadcast-address 10.5.5.31;
#  default-lease-time 600;
#  max-lease-time 7200;
}

cat wap.sh
#!/bin/bash if [ "$(whoami)" != root ]
then
    echo "You need administrator privileges to run this script"
    exit 1
fi service isc-dhcp-server stop

ifconfig eth1 down
ifconfig eth1 netmask 255.255.255.0
ifconfig eth1 10.0.0.1
ifconfig eth1 up

ifconfig wlan0 down
#ifconfig wlan0 netmask 255.255.255.0
ifconfig wlan0 192.168.0.1
ifconfig wlan0 up

service isc-dhcp-server start
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth1 -j ACCEPT

hostapd /etc/hostapd/hostapd.conf











1 commentaire:

  1. Best 8 casinos in Las Vegas, NV | Mapyro
    Looking for the best casino in 동두천 출장마사지 Las Vegas, NV? 이천 출장마사지 Mapyro is a 평택 출장샵 fun and 파주 출장마사지 easy to use 과천 출장안마 online directory of casinos.

    RépondreSupprimer