6

I'm new to the OS and chose this community to find some help on my problems. I have Lubuntu based on version 15.04; I'm very satisfied, though it's more complicated than windows, but faster and safer. Now I want some help with creating a wifi hotspot on my laptop using incoming connection from wired ethernet. I have read and watched many tutorials but neither helped me. The problem is that I can't install ap-hotspot from Terminal, as it says "Unable to locate package ap-hotspot". Is there any other way to do this? I'm using Dell Inpiron B120 old laptop with 512mb ram. Adapter is Broadcom 4318 and all drivers and firmware are installed. I don't know if any further information is needed.

5 Answers 5

3

ap-hotspot is pretty outdated as the developer has stopped working on it for quite some time now. I suggest using create_ap as an alternative. To install, type the following in terminal.

git clone https://github.com/oblique/create_ap
cd create_ap 
make install 

Complete details on installation and use is found here.

2
  • I typed the command in terminal several times, and after that there was created folder named create_ap, but the program isn't installed and so doesn't work. Now every time I type the command, I receive this: luka7@PC7:~$ git clone github.com/oblique/create_ap fatal: destination path 'create_ap' already exists and is not an empty directory. luka7@PC7:~$ cd create_ap luka7@PC7:~/create_ap$ make install The program 'make' can be found in the following packages: * make * make-guile Try: sudo apt-get install <selected package> luka7@PC7:~/create_ap$
    – luka7
    Jul 30, 2015 at 9:45
  • @luka7 you need to install make and other utilities needed to compile it by installing the build-essential package. You will probably also need to install the dependencies it list here. If the make install fails due to permissions, you can try sudo make install - you can also use checkinstall with sudo checkinstall instead of make install, it makes it easier to remove the package afters it is installed.
    – Wilf
    Jul 30, 2015 at 17:17
2

I don't think the PPA currently has a version of ap-hotspot available for 15.04, however you should be able to install it by downloading the deb file from here for another Ubuntu version (the below instructions use 14.10's) and installing it:

wget "https://launchpad.net/~nilarimogard/+archive/ubuntu/webupd8/+files/ap-hotspot_0.3-1%7Ewebupd8%7E4_all.deb"
sudo gdebi ap-hotspot_0.3-1~webupd8~4_all.deb

If at a later date the above links/commands don't work, the package may have been updated so you will need to download and install the latest version from here manually.

You can also download the file in a web browser from here and install it using Software Center.

Note this still may not work, as the script was designed for 13.10 so it probably needs a few tweaks to work with 15.04 and other versions.

You can then start it with:

sudo ap-hotspot start

You can also stop it:

sudo ap-hotspot stop

and configure it:

sudo ap-hotspot configure

See also:

  • Instructions for 12.04, 12.10, 13.10, 14.04 (including 'patch') & 14.10 can be found in my answer here, based on the original WebUp8 article.
1
  • 1
    Sorry for late response, I tried using your method and successfully installed ap-hotspot, but when I try to start it using terminal, it says starting wifi hotspot and nothing changes after that. I don't know may be it's caused of that I'm using 15.04 version. If you know some solution please tell me.
    – luka7
    Jul 30, 2015 at 9:40
1

Thanks for help everyone, but now I have already found the solution on Youtube. I used in terminal this command:"kde5-nm-connection-editor" and opened KDE connection editor and so I managed to create new Wi-Fi hotspot and it works very well.

1
0

I have this old script that helped me to make a WiFi-Hotspot from my ethernet connection. It might not work but its worth a try.

Code:

#!/bin/bash
### Setup a wifi Access Point on Ubuntu 12.04 (or its derivatives).

### make sure that this script is executed from root
if [ $(whoami) != 'root' ]
then
    echo "
This script should be executed as root or with sudo:
    sudo $0
"
    exit 1
fi

##############################################################
## Check whether the wireless card supports Access Point mode
##############################################################

### make sure that iw is installed
apt-get -y install iw

### check that AP is supported
supports_access_point=$(iw list | sed -n -e '/* AP$/p')
if [ "$supports_access_point" = '' ]
then
    echo "AP is not supported by the driver of the wireless card."
    echo "This script does not work for this driver."
    exit 1
fi

##############################################################
##  Setup and host a network
##############################################################

### install hostapd
apt-get -y install hostapd

### it should not start automatically on boot
update-rc.d hostapd disable

### get ssid and password
ssid=$(hostname --short)
read -p "The name of your hosted network (SSID) [$ssid]: " input
ssid=${input:-$ssid}
password='1234567890'
read -p "The password of your hosted network [$password]: " input
password=${input:-$password}

### get wifi interface
rfkill unblock wifi   # enable wifi in case it is somehow disabled (thanks to Darrin Wolf for this tip)
wifi_interface=$(lshw -quiet -c network | sed -n -e '/Wireless interface/,+12 p' | sed -n -e '/logical name:/p' | cut -d: -f2 | sed -e 's/ //g')

### create /etc/hostapd/hostapd.conf
cat <<EOF > /etc/hostapd/hostapd.conf
interface=$wifi_interface
driver=nl80211
ssid=$ssid
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=$password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
EOF

### modify /etc/default/hostapd
cp -n /etc/default/hostapd{,.bak}
sed -i /etc/default/hostapd \
    -e '/DAEMON_CONF=/c DAEMON_CONF="/etc/hostapd/hostapd.conf"'

################################################
## Set up DHCP server for IP address management
################################################

### make sure that the DHCP server is installed
apt-get -y install isc-dhcp-server

### it should not start automatically on boot
update-rc.d isc-dhcp-server disable

### set the INTERFACES on /etc/default/isc-dhcp-server
cp -n /etc/default/isc-dhcp-server{,.bak}
sed -i /etc/default/isc-dhcp-server \
    -e "/INTERFACES=/c INTERFACES=\"$wifi_interface\""

### modify /etc/dhcp/dhcpd.conf
cp -n /etc/dhcp/dhcpd.conf{,.bak}
sed -i /etc/dhcp/dhcpd.conf \
    -e 's/^option domain-name/#option domain-name/' \
    -e 's/^option domain-name-servers/#option domain-name-servers/' \
    -e 's/^default-lease-time/#default-lease-time/' \
    -e 's/^max-lease-time/#max-lease-time/'

sed -i /etc/dhcp/dhcpd.conf \
    -e '/subnet 10.10.0.0 netmask 255.255.255.0/,+4 d'
cat <<EOF >> /etc/dhcp/dhcpd.conf
subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.2 10.10.0.16;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}
EOF

#################################################
## Create a startup script
#################################################

cat <<EOF > /etc/init.d/wifi_access_point
#!/bin/bash

ext_interface=\$(ip route | grep default | cut -d' ' -f5)

function stop_wifi_ap {
    ### stop services dhcpd and hostapd
    service isc-dhcp-server stop
    service hostapd stop

    ### disable IP forwarding
    echo 0 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -D POSTROUTING -s 10.10.0.0/16 -o \$ext_interface -j MASQUERADE 2>/dev/null

    ### remove the static IP from the wifi interface
    if grep -q 'auto $wifi_interface' /etc/network/interfaces
    then
        sed -i /etc/network/interfaces -e '/auto $wifi_interface/,\$ d'
        sed -i /etc/network/interfaces -e '\$ d'
    fi

    ### restart network manager to takeover wifi management
    service network-manager restart
}

function start_wifi_ap {
    stop_wifi_ap
    sleep 3

    ### see: https://bugs.launchpad.net/ubuntu/+source/wpa/+bug/1289047/comments/8
    nmcli nm wifi off
    rfkill unblock wlan

    ### give a static IP to the wifi interface
    ip link set dev $wifi_interface up
    ip address add 10.10.0.1/24 dev $wifi_interface

    ### protect the static IP from network-manger restart
    echo >> /etc/network/interfaces
    echo 'auto $wifi_interface' >> /etc/network/interfaces
    echo 'iface $wifi_interface' inet static >> /etc/network/interfaces
    echo 'address 10.10.0.1' >> /etc/network/interfaces
    echo 'netmask 255.255.255.0' >> /etc/network/interfaces

    ### enable IP forwarding
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o \$ext_interface -j MASQUERADE

    ### start services dhcpd and hostapd
    service hostapd start
    service isc-dhcp-server start
}

### start/stop wifi access point
case "\$1" in
    start) start_wifi_ap ;;
    stop)  stop_wifi_ap  ;;
esac
EOF

chmod +x /etc/init.d/wifi_access_point

### make sure that it is stopped on boot
sed -i /etc/rc.local \
    -e '/service wifi_access_point stop/ d'
sed -i /etc/rc.local \
    -e '/^exit/ i service wifi_access_point stop'


### display usage message
echo "
======================================

Wifi Access Point installed.

You can start and stop it with:
    service wifi_access_point start
    service wifi_access_point stop

"
0

There's a good solution here. The additional step I had to do was:

  • Explicitly connect to the Lubuntu hotspot wifi connection from the Lubuntu machine itself using 'connect to hidden network'.

The SSID was visible on my Android device immediately.

I saw that the iptables rules were created on Lubuntu by the Network Manager automatically. I was sharing a tethered usb Internet connection over the WiFi hotspot. I don't see a necessity for the 'cloned MAC address' field though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .