In situ anion exchange has been proved to be an efficient method for facile modification of polymeric ionic liquids (PILs)-based stationary phases. In this work, an on-fiber anion exchange process was utilized to tune the extraction performance of a multi-walled carbon nanotubes (MWCNTs)-poly(1-vinyl-3-octylimidazolium bromide) (poly(VOIm + Br − ))-coated solid-phase microextraction (SPME) fiber. MWCNTs were first coated onto the stainless steel wire through a layer-by-layer fabrication method and then the PILs were coated onto the MWCNTs physically. Anion of the MWCNTs–poly(VOIm + Br − ) fiber was changed into bis(triflroromethanesulfonyl)imide (NTf 2 − ) and 2-naphthalene-sulfonate (NapSO 3 − ) by on-fiber anion exchange. Coupled to gas chromatography, the MWCNTs–poly(VOIm + Br − ) fiber showed acceptable extraction efficiency for hydrophilic and hydrogen-bonding-donating alcohols, with limits of detection (LODs) in the range of 0.005–0.05μgmL −1 ; after the anion exchange with NTf 2 − , the obtained MWCNTs–poly(VOIm + NTf 2 − ) fiber brought wide linear ranges for hydrophobic n-alkanes with correlation coefficient (R) ranging from 0.994 to 0.997; aromatic property of the fiber was enhanced by aromatic NapSO 3 − anions to get sufficient extraction capacity for phthalate esters and halogenated aromatic hydrocarbons. The MWCNTs–poly(VOIm + NapSO 3 − ) fiber was finally applied to determine several halogenated aromatic hydrocarbons in groundwater of industrial park.