# Discourse-setup uses ifconfig to check the IP address for Let's Encrypt, but it's not available on Debian stretch

**URL:** <https://meta.discourse.org/t/discourse-setup-uses-ifconfig-to-check-the-ip-address-for-lets-encrypt-but-its-not-available-on-debian-stretch/61080>\
**Category:** Bug\
**Created:** [16 أبريل 2017، 9:14م UTC](https://meta.discourse.org/t/discourse-setup-uses-ifconfig-to-check-the-ip-address-for-lets-encrypt-but-its-not-available-on-debian-stretch/61080 "2017-04-16T21:14:53Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![chrisc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisc/32/119982_2.png) [@chrisc](https://meta.discourse.org/u/chrisc)\
**Post date:** [16 أبريل 2017، 9:14م UTC](https://meta.discourse.org/t/discourse-setup-uses-ifconfig-to-check-the-ip-address-for-lets-encrypt-but-its-not-available-on-debian-stretch/61080/1 "2017-04-16T21:14:53Z")

</div>

These lines in `discourse-setup` depend on `ifconfig`, but Debian Stretch doesn’t have `ifconfig`:

```bash
  local IFACE=none
  local IFCONFIG=`which ifconfig`
  /sbin/route |grep default > /tmp/route$PPID

  if grep default /tmp/route$PPID > /dev/null
  then
      local IFACE=`cut -c 73-100 /tmp/route$PPID |head -1`
  else
    echo WARNING: Cannot check your IP number.
  fi
  local IP=`$IFCONFIG $IFACE|grep "inet addr:" |cut -d":" -f 2|cut -d" " -f1|head -1`

```

The way I check for the IP address on Debian Stretch is to use `hostname -i`, for example:

```bash
#!/bin/bash

local IFCONFIG=$(which ifconfig)
local HOSTNAME=$(which hostname)

# Check is ifconfig is available
if [[${IFCONFIG}]]; then
  # https://stackoverflow.com/a/4046101
  local IP=$($IFCONFIG | fgrep 'inet addr:' | fgrep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}' | head -n1)
# If we don't have ifconfig then try to use hostname
elif [[${HOSTNAME}]]; then
  local IP=$(hostname -i)
else
  echo "Sorry, couldn't find ifconfig or hostname so couldn't use them to work out the local IP address"
fi

```

---

_[View the full topic](https://meta.discourse.org/t/discourse-setup-uses-ifconfig-to-check-the-ip-address-for-lets-encrypt-but-its-not-available-on-debian-stretch/61080)._
