diff --git a/IPv6Addr.cabal b/IPv6Addr.cabal
--- a/IPv6Addr.cabal
+++ b/IPv6Addr.cabal
@@ -1,5 +1,5 @@
 name:                IPv6Addr
-version:             1.0.2
+version:             1.0.3
 synopsis:            Library to deal with IPv6 address text representations.
 description:         Library to deal with IPv6 address text representations, canonization and manipulations.
 homepage:            https://github.com/MichelBoucey/IPv6Addr
@@ -23,7 +23,7 @@
   build-depends:    base         >=4.8 && < 5
                   , text         >=1.1 && < 1.3
                   , iproute      >=1.3 && < 1.8
-                  , network      >=2.5 && < 2.7
+                  , network      >=2.5 && < 2.8
                   , random       >=1.0 && <= 1.1
                   , attoparsec   >=0.12 && < 0.14
                   , aeson        >= 0.8.0.2 && < 1.4
diff --git a/Text/IPv6Addr.hs b/Text/IPv6Addr.hs
--- a/Text/IPv6Addr.hs
+++ b/Text/IPv6Addr.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 
 module Text.IPv6Addr
@@ -39,7 +40,13 @@
 import           Data.Monoid          ((<>))
 import qualified Data.Text            as T
 import qualified Data.Text.Read       as R (decimal)
+
+#if MIN_VERSION_network (2,7,0)
+import           Network.Socket       (HostName)
+#else
 import           Network              (HostName)
+#endif
+
 import           Network.Info
 import           Numeric              (showHex)
 import           System.Random        (randomRIO)
