If you own an Audi with unit MMI 3G Plus which doesn’t have SIM card slot, you might miss Audi Connect & Google Earth layer on local maps.

By using external module, you can enable this feature & also make in-car wifi hotspot.

What you need?

* – can use just one WIFI card, but if you wish to make internet hotspot in your car for other you’ll need two cards, they are not expensive.

** – in this product we have included ISO file to install on to SDCARD also instructions which file need to edit if you don’t want doing all below coding.

How to start?

You need to install Raspbian – you can download it from here: https://www.raspberrypi.org/downloads/raspbian/

How to setup raspbian tutorials you can find here:
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up

When you install raspbian, connect your box with monitor, keyboard, mouse and ethernet cable (to have internet connection).

Go to main settings and make sure that SSH and VNC are enabled – you’ll not need to connect raspberry to the monitor / mice and keyboard each time when you want make changes.

Do not connect yet any external USB WIFIs or 4G modem.

Terminal things..

Open terminal, and login as root:

sudo su

all bellow commands must be executed as root.

Ok, so let’s check if service systemd-networkd it’s installed, its necessary for another steps.

systemctl status systemd-networkd
systemctl status systemd-resolved

that’s the two separate commands, booth of them must return LOADED:LOADED

audi connect mmi 3g plus upgrademyaudi.net - audi connect raspberry pi
systemctl status systemd-networkd
upgrademyaudi.net - audi connect raspberry pi
systemctl status systemd-resolved

to exit from last one, you need press “q” on your keyboard.

Turn off network manager

Another step is disable and remove DHCP server, we will not need it now.

systemctl disable dhcpcd
apt-get -y remove dhcpcd5 openresolv
systemctl disable networking.service 
systemctl disable NetworkManager

Create new network configuration

Create new file by using this command:

nano /etc/systemd/network/eth0.network

and then copy & paste there:

[Match]
Name=eth0
[Network]
Description=eth0 dhcp
DHCP=yes
IPForward=yes

now we will create new WIFI card configuration to connect with your mobile phone hotspot.

nano /etc/systemd/network/wlan0.network

and paste there:

[Match]
Name=wlan0

[Network]
Description=RasPi wlan0 dhcp
DHCP=yes
IPForward=yes

and start network:

systemctl enable systemd-networkd.service
systemctl start systemd-networkd.service
systemctl status systemd-networkd

there should be message like this:

systemctl status systemd-networkd upgrademyaudi.net - audi connect raspberry pi
systemctl status systemd-networkd

it must be also loaded:loaded.

Now we will define onboard wifi as Wlan0 – with multiple wifi cards its important to do, as sometimes raspi might change names for wifi and mess a bit..

type in terminal:

ip a

copy MAC address from Wlan0

MAC address - Wlan0 upgrademyaudi.net - audi connect raspberry pi
MAC address – Wlan0

type in terminal:

nano /etc/systemd/network/10-wlan0.link

copy there & change MACAddress to yours one:

[Match]
MACAddress=YOUR_WIFI_MACADDRESS
#EXAMPLE: MACAddress=b8:27:eb:b3:70:e3

[Link]
Description=Internes_Wlan
Name=wlan0

Now we can proceed with system updates, type in terminal:

sudo apt-get update
sudo apt-get dist-upgrade

Now we will configure your mobile phone hotspot (one of the ways to share internet connection with raspi – if not using 4G modem).

Get information about your mobile phone hotspot name and password (you can also change them in settings) and make sure you have typed it correctly!

Open terminal and type:

wpa_passphrase "SSID" "PASSWORD"
  • SSID – name of hotspot wifi.
  • PASSWORD – password to connect with your mobile phone hotspot.

you’ll get something like this:

upgrademyaudi.net - audi connect raspberry pi
Encrypted hotspot password.

it’s an encrypted hotspot password, copy your output as you’ll need it.

In terminal type:

nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

and you’ll see:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
country=GB
ap_scan=1
fast_reauth=1
eapol_version=1
autoscan=periodic:30

network={
ssid="Adams Hotspot"
scan_ssid=1
psk="Generated PASSWD"
priority=80
}

network={
ssid="Another Hotstpo"
scan_ssid=1
psk=GENERATED_ENCRYPTED_PASSWD
priority=50
}

so, two last networks are my examples of use, you can use many hotspot with which raspi can connect to get internet connection, if you have just one, add just one I do recommend also to add home wifi details.

now, type in terminal:

nano /etc/systemd/system/[email protected]

and copy & paste this (do not change anything):

[Unit]
Description=WPA supplicant daemon (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/sbin/ip link set dev %i up
ExecStart=/sbin/iw %i set power_save off
ExecStart=/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant-%i.conf

ExecStop=/sbin/ip link set dev %I down

[Install]
WantedBy=multi-user.target

now you can activate and start services:

systemctl enable [email protected]
systemctl start [email protected]

systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
systemctl status systemd-resolved

Once started, the systemd creates its own file resolv.conf under var/run/systemd. However, it is common for DNS resolver information in the /etc/resolv.conf file and many applications still rely on this file. For compatibility, we create a symbolic link to /etc/resolv.conf

mv /etc/resolv.conf /etc/resolv.conf.ORIG
ln ­sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

systemctl restart systemd-resolved.service

Check whether IPForward is given

nano /etc/sysctl.conf

check that the following section is not commented out:
net.ipv4.ip_forward = 1
Otherwise remove the “#” and save the file

and check:

nano /proc/sys/net/ipv4/ip_forward

The content must be “1

Firewall

Run as root again:

apt-get install iptables-persistent

Click for the file rules.v4 [YES]! For IPV6 you can do that too, but you don’t have to! Now we add a rule in terminal:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables-save > /etc/iptables/rules.v4

It is important to say here that the firewall has only been configured to the extent that it works! If you want to protect your RPI, you have to configure the firewall further!
Just edit it according to your wishes!

Now you can connect another USB wifi card.

Open terminal and type:

nano /etc/systemd/network/wlan1.network

copy there (do not change anything):

[Match]
Name=wlan1

[Network]
Description=Audi wlan1 dhcp
DHCPServer=yes IPForward=yes
[Address]
Address=192.168.1.254/24
Broadcast =192.168.1.255

[DHCPServer]
PoolOffset=10
PoolSize=40
EmitDNS=yes
DNS=8.8.8.8
DNS=8.8.4.4
DefaultLeaseTimeSec=600
MaxLeaseTimeSec=7200

save and exit, next type:

ip a

and again copy MACAddress of Wlan1

upgrademyaudi.net - audi connect raspberry pi
Wlan1 – MACAddress

then type in terminal:

nano /etc/systemd/network/11-wlan1.link

and in new file add:

[Match]
MACAddress=CHANGE_TO_YOUR_WIFI_MACADDRESS
#EXAMPLE: MACAddress=b8:27:eb:b3:70:e3

[Link]
Description=WLAN-Stick
Name=wlan1

This wifi card will connect with your MMI onboard wifi to share internet connection. So now you need to have MMI wifi details. The easiest way:

Start your car and go to the MEDIA tab in MMI

MMI 3G+ > Media

Then scroll down and you will see that wireless icon and text label Not connected

MMI 3G+ > Media > Wifi

Go in to this option, and you should see this:

MMI 3G+ > Media > Wifi

Click again in to WLAN connection settings

MMI 3G+ > Media > Wifi > Connection details

and write down your SSID and Password we will need this now.

Now go back to raspi terminal and type:

wpa_passphrase "YourMMISSID" "YourMMIPASSWORD"

Do you remember this? few lines before we have used this command to generate encrypted password.

copy your output to notepad etc.. and type in terminal:

nano /etc/wpa_supplicant/wpa_supplicant-wlan1.conf

and fill it up with:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
country=DE
ap_scan=1

#here you can remove this network with ( ) and copy your output from previous command.
network={
ssid="Your MMI SSID"
psk=generatedPasswordfromAboveCommand
}

save and exit, another two commands to run in terminal:

systemctl enable [email protected]
systemctl start [email protected]

You can test your device now, it will not yet share internet with MMI as it needs also few changes – with scripts – but you can check if it will connect with your mobile phone hotspot and with MMI.

Another parts will be adding 4G modem and another wifi card to use as onboard hotspot for other.

Let’s connect the third USB wifi card, and type in terminal:

ip a

again need to copy MACAddress from Wlan2

Wlan2 – MACAddress

then type in terminal:

nano /etc/systemd/network/12-wlan2.link

and copy there:

[Match]
MACAddress=74:da:38:ea:0f:a8 #change it to your MACAddress!

[Link]
Description=Hotspot_Wlan
Name=wlan2

now we can install two application which we will use for onboard hotspot. (remember that 1 line it’s 1 command!)

sudo apt-get update
sudo apt-get install dnsmasq
sudo apt-get install hostapd
sudo apt-get install isc-dhcp-server

let’s edit DHCP settings:

sudo nano /etc/dhcpcd.conf

on the end of file add:

interface wlan2
static ip_address=192.168.220.1/24
static routers=192.168.220.0

lets edit hostapd.conf:

sudo nano /etc/hostapd/hostapd.conf

remove everything and add there:

interface=wlan2
driver=nl80211

hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
ignore_broadcast_ssid=0

auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

ssid=YOUR_NEW_HOTSPOT_NAME
wpa_passphrase=PASSWORD_FOR_HOTSPOT_PAINTEXT

in ssid write a name for your incar hotspot, and in wpa_passphrase password you want to have and share with other people in your car.

ok, lest move on 🙂

type in terminal:

sudo nano /etc/default/hostapd

find there DAEMON_CONF and DAEMON_OPTS and put # before those names and copy & paste this on the end of file:

DAEMON_CONF=“/etc/hostapd/hostapd.conf"

should looks like this:

/etc/default/hostapd

Now similar we need to do in file:

sudo nano /etc/init.d/hostapd

find DAEMON_CONF and replace it with:

DAEMON_CONF=/etc/hostapd/hostapd.conf
/etc/init.d/hostapd

Next step is to make a backup of dnsmasq file:

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig

and open:

sudo nano /etc/dnsmasq.conf

remove all content from file, and copy & paste this (do not change anything!):

interface=wlan2       # Use interface wlan2
listen-address=192.168.220.1   # Specify the address to listen on
bind-interfaces      # Bind to the interface
server=8.8.8.8       # Use Google DNS
domain-needed        # Don't forward short names
bogus-priv           # Drop the non-routed address spaces.
dhcp-range=192.168.220.50,192.168.220.150,12h # IP range and lease time

and now we can add few firewall rules:

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

sudo iptables -A FORWARD -i wlan0 -o wlan2 -m state --state RELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan2 -o wlan0 -j ACCEPT

sudo iptables -A FORWARD -i eth1 -o wlan2 -m state --state RELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan2 -o eth1 -j ACCEPT

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

sudo nano /etc/rc.local

iptables-restore < /etc/iptables.ipv4.nat

exit 0

ok we are nearly done..

sudo service hostapd start
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
sudo service dnsmasq start

lets configure yet last wifi card, so type in terminal:

nano /etc/systemd/network/wlan2.network

and copy & paste this (do not change anything):

[Match]
Name=wlan2

[Network]
Description=RasPi wlan2 dhcp
DHCP=yes
IPForward=yes

[Address]
Address=192.168.220.1/24
Broadcast =192.168.220.255

[DHCPServer]
PoolOffset=10
PoolSize=40
EmitDNS=yes
DNS=8.8.8.8
DNS=8.8.4.4
DefaultLeaseTimeSec=600
MaxLeaseTimeSec=7200

last thing is just add our 4G modem, so plug it in to raspi, and type:

ip a

it should appear as eth1

Raspi – ETH1 – 4G Modem

this modem works out of the box, but in some network carriers needs to configure connection in modem settings.

another step is configuring MMI to work with this, we have got tutorial what change in hidden green menu to enable Audi Connect & Google earth here – YES it’s for cars with simcard slot but! you got it now 🙂

Also you’ll need few scripts to apply in your MMI, we have included them in this product (click) – there will be also full our product image which means you don’t need to type all above commands – just restore it on to 32GB SDCARD and change MACAddress’es of cards (as every wifi card got different macaddress) and passwords / SSID for wifi.

+1+2+3+4+5 (8 votes, average: 4.75 out of 5)
Subscribe
Notify of
4 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
4
0
Would love your thoughts, please comment.x
()
x
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.