The $\mathrm{S_N1}$ or $\mathrm{S_N2}$ reaction of alkyl halide with nitrite ion is complicated one since nitrite is an ambident nucleophile. For instance, it was reported that silver nitrite reacts with alkyl halides to give nitrites while sodium nitrite gives more nitroalkane than alkyl nitrite (based on Hard Acid/Hard Base concept; Ref.1):
$$\ce{AgNO2 + R-Br -> R-ONO + AgBr \tag1}$$
$$\ce{NaNO2 + R-Br -> R-NO2 + NaBr \tag2}$$
However, these results were contradicted by work of Kornblum who compared the reactions of iodoalkanes with $\ce{NaNO2}$ and $\ce{AgNO2}$ (Ref.2):
$$\ce{C7H15CH2-I + AgNO2/NaNO3 -> C7H15CH2-NO2 + C7H15CH2-ONO + AgI \tag3}$$
It was shown by the work of Kornblum and coworkers that both primary alkyl bromides and iodides have given excellent yields of pure nitroalkanes (73-83% as major product) when $\ce{AgNO2}$ is used as the nucleophile (Ref.3). In contrast, primary chlorides are completely inert under the conditions $(\pu{0\!-\! 25 ^\circ C}/\ce{Et2O})$:
$$
\begin{array}{l|r|r}
\hline
\text{Heloalkane} & \% \ \ce{R-NO2} & \% \ \ce{R-ONO} \\
\hline
\text{$n$-Butyl bromide} & 73 & 13 \\
\text{$n$-butyl iodide} & 74 & 12 \\
\text{$n$-Hexyl chloride} & 0 & 0 \\
\text{$n$-Hexyl bromide} & 76 & 10 \\
\text{$n$-Hexyl iodide} & 78 & 13 \\
\text{$n$-Heptyl bromide} & 79 & 11 \\
\text{$n$-Heptyl iodide} & 82 & 10 \\
\text{$n$-Octyl chloride} & 0 & 0 \\
\text{$n$-Octyl bromide} & 80 & 14 \\
\text{$n$-Octyl iodide} & 83 & 11 \\
\hline
\end{array}
$$
Based on the results obtained, the authors had concluded that this is a good method to prepare primary-nitroalkanes (Note that nitroalkanes, $\ce{R-NO2}$, are thermodynamically more stable than alkyl nitrites, $\ce{R-ONO}$; Ref.1). Some of the further work by Kornblum et al. have noted that use of tertiary alkyl halides to prepare corresponding nitro compounds is useless (0-5% yield) while those reactions with secondary alkyl halides have also given only less than 15% yield of expected nitroalkanes (Ref.4). After extensive work on synthesis of nitroalkanes and alkyl nitrites, declared that:
In the synthesis of saturated primary nitro compounds, silver nitrite gives nitroparaffins in about 80% yield as against about 60% yields obtained with sodium nitrite. While silver nitrite is, therefore, the reagent of choice here, the lower cost and ready availability of sodium nitrite, the not very large disparity in yield, and the shorter reaction time all combine to make sodium nitrite an excellent second choice*" (p.114, Ref.2; and Ref.5).
In their mechanistic studies, Kornblum et al. (Ref.6) have found that yield of $\ce{R-NO2}$ isomer falls progressively when substrate changes from primary to secondary to tertiary halide. In contrast, the yield of $\ce{R-ONO}$ counterpart increases with the same order of primary to secondary to tertiary. Although there is a steric effect in play, the authors conclude that the reaction proceeds via a transition state, which has both $\mathrm{S_N1}$ and $\mathrm{S_N2}$ character in proportions that vary gradually with the structure of the halide. The greater the $\mathrm{S_N1}$ character of the transition state, the greater is the preferences for covalency formation with the atom with higher electronegativity (e.g., $\ce{R-ONO}$). Conversely, the greater the $\mathrm{S_N2}$ contribution to the transition state, the greater the preferences for covalency formation to the atom with lower electronegativity (e.g., $\ce{R-NO2}$).
In this regard, I'd say the reaction, $\ce{R-X + NaNO2 ->[DMF] R-NO2 + NaX}$ would proceed differently under different conditions. Since the solvent is (assuming) anhydrous DMF, the condition is set for $\mathrm{S_N2}$ reactions. Thus, for instance:
- If $\ce{X = Cl}$ and $\ce{R-X}$ is a primary alkyl chloride, the reaction would not proceed.
- If $\ce{X = Br or I}$ and $\ce{R-X}$ is a primary alkyl halide, the reaction would
proceed rapidly to give nitroalkane, $\ce{R-NO2}$, as the major product but in lower yield $(\approx60\%)$. There should also be some alkyl nitrites, $\ce{R-ONO}$ as well (Ref.3).
- If $\ce{X = Br or I}$ and $\ce{R-X}$ is a secondary alkyl halide, the reaction would
proceed to give both nitroalkane, $\ce{R-NO2}$, and alkyl nitrites, $\ce{R-ONO}$, as the product. The yield would be lower $(\approx20\%)$ (Ref.4).
I think that would be enough of discussion since very little information is given in the question. For example, we cannot decide whether reaction goes in ether $\mathrm{S_N1}$ or $\mathrm{S_N2}$ without knowing the nature of $\ce{R}$ group. Knowing the structure of $\ce{R}$ group is extremely important since even some specific primary halides such as neo-pentyl halide do not react under same conditions where other primary halides proceed rapidly.
Finally, it is noteworthy to mention following reaction, which play a significant role in the product ratio of $\ce{R-NO2}$ to $\ce{R-ONO}$:
- Reactions of the blue benzhydrylium salts, $\bf{1}$-$\ce{BF4}$, with $\ce{n-Bu4N+NO2-}$ in anhydrous acetonitrile gives colorless adducts, $\bf{1}$-$\ce{NO2}$ (Ref.5):
The monitoring method in Ref.5 does not suggest the product is direct formation of $\bf{1}$-$\ce{NO2}$ or through the kinetic product, $\bf{1}$-$\ce{ONO}$. It was suggest that when use more reactive benzhydrylium salts for the reaction, the monitored reaction process is the formation of $\bf{1}$-$\ce{ONO}$, which successively rearrange to the observed nitro compounds $\bf{1}$-$\ce{NO2}$. To prove this theory, the authors prepared pure $\bf{1}$-$\ce{ONO}$ in different method (Reaction $\bf{A}$), and monitored its rearrangement to thermodynamically stable $\bf{1}$-$\ce{NO2}$ (Reaction $\bf{B}$):
These experiments clearly suggest that preparation of nitroalkane is not simple as the reaction suggests, but rather complicated process!
Edit: In reaction $\bf{A}$, the aromatic ring of starting material $\bf{1i}$ and $\bf{1j}$ have two different para-substitution $\ce{R}$s: $\ce{R} = \ce{OMe}$ for $\bf{1i}$ and $\ce{R} = \ce{Me}$ for $\bf{1j}$ (Ref.5).
References:
- Ian Fleming, In Frontier Orbitals and Organic Chemical Reactions-Student Edition; John Wiley & Sons, Ltd.: Chichester, West Sussex, United Kingdom, 2009, p. 122–123 (ISBN 978-0-470-74660-8).
- Nathan Kornblum, “The Synthesis of Aliphatic and Alicyclic Nitro Compounds,” Organic Reactions 1962, Vol 12, 101 – 156 (DOI: https://doi.org/10.1002/0471264180.or012.03).
- Nathan Kornblum, Bernard Taub, and Herbert E. Ungnade, “The Reaction of Silver Nitrite with Primary Alkyl Halides,” J. Am. Chem. Soc. 1954, 76(12), 3209–3211 (DOI: https://doi.org/10.1021/ja01641a029).
- Nathan Kornblum, Robert A. Smiley, Herbert E. Ungnade, Alan M. White, Bernard Taub, and Stephen A. Herbert Jr., “The Reaction of Silver Nitrite with Secondary and Tertiary Alkyl Halides,” J. Am. Chem. Soc. 1955, 77(21), 5528–5533 (DOI: https://doi.org/10.1021/ja01626a028).
- Alexander A. Tishkov, Uli Schmidhammer, Stefan Roth, Eberhard Riedle, and Herbert Mayr, "Ambident Reactivity of the Nitrite Ion Revisited," Angew. Chem. Int. Ed. 2005, 44(29), 4623 –4626 (DOI: https://doi.org/10.1002/anie.200501274).
- Nathan Kornblum, Robert A. Smiley, Robert K. Blackwood, and Don C. Iffland, “The Mechanism of the Reaction of Silver Nitrite with Alkyl Halides. The Contrasting Reactions of Silver and Alkali Metal Salts with Alkyl Halides. The Alkylation of Ambident Anions,” J. Am. Chem. Soc. 1955, 77(23), 6269–6280 (DOI: https://doi.org/10.1021/ja01628a064).